-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tail of NICKNAME text-list values dropped #140
Comments
@hildigerr thanks for the detailed description in #138, I'll definitely take a look at this and try to make the behavior more consistent. |
For the record: The same thing happens with the value field of NOTE contentlines: As soon as it contains a comma, the rest is stripped (possibly true for all 'text' type value fields) Could it be that (formally) the issue here is not vobject's parsing, but the wrong format of the input? According to Vcard RFC 6350 (para 3.4): all commas should be escaped and newlines represented by "\n". When I modify the end of
then the I did not look into the reverse direction, where the escaped comma should be unescaped on output (I am glad I got this far), but maybe it's an idea for a workaround for other incorrect Vcard export implementations? I noticed that, when exporting a contact with a NOTE field containing commas from Apple's Contacts using iCould for Windows into Vcard format (.vcf), that commas are not escaped, also giving problems when parsing with vobject. If I change the input .vcf file to provide escaped commas, all works fine... |
The RFC states that "Some properties may contain one or more values delimited by a COMMA character (U+002C). Therefore, a COMMA character in a value MUST be escaped with a BACKSLASH character (U+005C), even for properties that don't allow multiple instances (for consistency)." So, only COMMAs which are part of the value should be escaped. As in: NICNAME;TYPE=home:Bob,Man of many\, many\, many names |
@hildigerr You are right of course. That's why I tried IMHO it is not a problem in vobject, but with the input data. However, since the developers have implemented other 'workarounds' for incorrect implementations... |
vobject.readOne('BEGIN:VCARD\r\nVERSION:3.0\r\nCATEGORIES;TYPE=work:Doctor,med\r\nNICNAME;TYPE=home:Nick,Bob\r\nFN:Dr. Given Middle Family IV\r\nEND:VCARD\r\n').serialize()
Results in:
BEGIN:VCARD
VERSION:3.0
CATEGORIES;TYPE=work:Doctor,med
FN:Dr. Given Middle Family IV
NICNAME;TYPE=home:Nick
END:VCARD
Dropping the second nickname in the list, "Bob".
See also: #138 for description of deeper issue due to inconsistent handling of text-list values.
The text was updated successfully, but these errors were encountered: