-
Notifications
You must be signed in to change notification settings - Fork 93
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
replace str.decode / str.encode for base64 and quoted-printable. should fix #20 #21
Conversation
@prauscher I had to add bytes() before base64 decoding, see arska@fd07a9f |
@arska thank you, but line.value.encode("utf-8") works in python2 too |
+1 |
@@ -147,7 +149,7 @@ def encode(cls, line): | |||
if not line.encoded: | |||
encoding = getattr(line, 'encoding_param', None) | |||
if encoding and encoding.upper() == cls.base64string: | |||
line.value = line.value.encode('base64').replace('\n', '') | |||
line.value = codecs.encode(line.value.encode(coding), "base64").decode("utf-8") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable 'coding' is not defined? Is this a typo?
It looks like when my vcard has a photo which is base64 encoded, this breaks vcard.serialize().
I'm attaching a sample vcard test_file. The vcard has photo data encoded in base64 format.
On python 2.7, a simple vcard.readOne(...).serialize() will fail.
sample_vcard.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps my pull request on top will fix this: #49
Fix bad backslash escape usage.
as said. assumed internal encoding of utf-8, but actually i'm not entirely sure if this is how you handle things. therefore please tell me what to change and i'll do extra commits