Skip to content
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

Merged
merged 4 commits into from
Aug 26, 2016

Conversation

prauscher
Copy link
Contributor

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

@arska
Copy link

arska commented May 5, 2016

@prauscher I had to add bytes() before base64 decoding, see arska@fd07a9f

@prauscher
Copy link
Contributor Author

@arska thank you, but line.value.encode("utf-8") works in python2 too

@serathius
Copy link

+1

@esalazar esalazar added this to the 0.9.3 milestone Aug 26, 2016
@esalazar esalazar merged commit 4062ab7 into skarim:master Aug 26, 2016
@@ -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")
Copy link

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

Copy link
Contributor

@pbiering pbiering Nov 15, 2016

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

lucc pushed a commit to lucc/vobject that referenced this pull request Apr 9, 2024
Fix bad backslash escape usage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants