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
Make vobject python3-compatible #20
Comments
@prauscher I think you should use the encoding given in the vcard-file for decoding the quoted-printable encoded fields instead of defaulting to UTF-8. It is available as a variable a few lines further up. It would be really nice if you could add some test case reproducing the issue to make sure we handle encoded characters correctly on all Python versions |
@Rondom the encoding given in the line above is "b" for base64. I currently see no other encoding-variable than "utf-8" A simple test case should be
the parsed FN should equal to the parsed N - "Meister Ede". You can see that fun even increases when PHOTO is involved ;) |
running into similar problem, and above patch seems to fix it. example fragment: LABEL;WORK;ENCODING=QUOTED-PRINTABLE:100 Waters Edge=0D=0ABaytown, LA 30314=0D=0AUnited States of America I don't see where to get the encoding either.. it's not in my VCARD test file. |
oh, I guess it can be added to the VCARD as follows: LABEL;HOME;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:42 Plantation St.. according to this: https://www.imc.org/pdi/vcal-10.txt it also mentions that the default encoding is ASCII.. so we take CHARSET or default to ASCII..? |
Mhh. I'm not sure if defaulting to ASCII is a good thing, as this will break as soon as any ä, ö. ü or related is contained (which would be against the standard probably, but I have seen several iCals without the CHARSET-option). As UTF-8 is ASCII extended, i'd leave UTF-8 as default. |
that sounds fine to me.. would you feel like adding some test cases to your patch..? I'd be happy to give that a try as well.. |
python-vobject doesn't support Python3: skarim/vobject#20
replace str.decode / str.encode for base64 and quoted-printable. should fix #20
althrough vobject is distributed as python3-compatible, it contains lines like https://github.com/eventable/vobject/blob/master/vobject/vcard.py#L137 - str.decode("base64") etc is only supported in python2, so using vobject in a python3-environment especially fails when base64-encoded photos or such are parsed.
The text was updated successfully, but these errors were encountered: