Open neilkatin opened 3 years ago
I have a similar issue under Python 3.9.5. I found I had to convert the ORG and CATEGORIES values to a list but not the TITLE.
I have this issue on python 3.8.10, vobject 0.9.6.1 from pip
To fix this i tried to do same as Android Contacts working with my cyrrilic - encode it with quoted-printable
import vobject
vcard = vobject.vCard()
vcard.add('fn').value = 'John Doe'
vcard.add('org').value = 'Acme inc'
assert 'BEGIN:VCARD\r\nVERSION:3.0\r\nFN:John Doe\r\nORG:A;c;m;e; ;i;n;c\r\nEND:VCARD\r\n' == vcard.serialize()
And with quopri
import quopri
import vobject
vcard = vobject.vCard()
vcard.add('fn').value = 'John Doe'
org = quopri.encodestring('Acme inc'.encode()).decode()
vcard.add('org;charset=utf-8;encoding=quoted-printable').value = org
assert 'BEGIN:VCARD\r\nVERSION:3.0\r\nFN:John Doe\r\nORG;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:Acme inc\r\nEND:VCARD\r\n' == vcard.serialize()
Apparently, this works not because of specifying the encoding, but because of the adding parameters to ORG =\
This problem seems to be very similar to #138, but since 138 was closed I'm submitting a new issue.
If I assign a string value to a vCard category value it gets serialized one letter at a time. If I assign a list with one string entry it works properly.
I replicated this on both the current released version (0.9.6.1) and on the master branch in from git.
Here's a short test program that demonstrates the issue:
Here's the output (on a python 3.8 system):