FreeBSD Bugzilla – Attachment 205028 Details for
Bug 238543
www/pycarddav: Syncing a contact with UTF-8 characters fails
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Instead of unconditionally returning unicode, i check for the used charset with chardet.detect()
patch-pycarddav_model.py (text/plain), 1.44 KB, created by
Oliver Adler
on 2019-06-13 09:24:07 UTC
(
hide
)
Description:
Instead of unconditionally returning unicode, i check for the used charset with chardet.detect()
Filename:
MIME Type:
Creator:
Oliver Adler
Created:
2019-06-13 09:24:07 UTC
Size:
1.44 KB
patch
obsolete
>--- pycarddav/model.py.orig 2014-02-04 23:38:46 UTC >+++ pycarddav/model.py >@@ -27,6 +27,7 @@ The pycarddav abstract model and tools for VCard handl > from __future__ import print_function > > import base64 >+import chardet > import logging > import sys > from collections import defaultdict >@@ -197,8 +198,17 @@ class VCard(defaultdict): > > @property > def name(self): >- return unicode(self['N'][0][0]) if self['N'] else '' >+ #return unicode(self['N'][0][0]) if self['N'] else '' >+ if self['N']: >+ if type(self['N'][0][0]) is unicode: >+ return self['N'][0][0] >+ else: >+ return unicode(self['N'][0][0], chardet.detect(self['N'][0][0])['encoding']) >+ else: >+ return '' > >+ #return unicode(self['N'][0][0], chardet.detect(self['N'][0][0])['encoding']) if self['N'] else '' >+ > @name.setter > def name(self, value): > if not self['N']: >@@ -207,7 +217,14 @@ class VCard(defaultdict): > > @property > def fname(self): >- return unicode(self['FN'][0][0]) if self['FN'] else '' >+ #return unicode(self['FN'][0][0]) if self['FN'] else '' >+ if self['FN']: >+ if type(self['FN'][0][0]) is unicode: >+ return self['FN'][0][0] >+ else: >+ return unicode(self['FN'][0][0], chardet.detect(self['FN'][0][0])['encoding']) >+ else: >+ return '' > > @fname.setter > def fname(self, value):
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 238543
: 205028 |
205321
|
205686