summaryrefslogtreecommitdiff
path: root/vobject/vcard.py
diff options
context:
space:
mode:
Diffstat (limited to 'vobject/vcard.py')
-rw-r--r--vobject/vcard.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/vobject/vcard.py b/vobject/vcard.py
index dd60b73..d4fe513 100644
--- a/vobject/vcard.py
+++ b/vobject/vcard.py
@@ -1,5 +1,7 @@
"""Definitions and behavior for vCard 3.0"""
+import codecs
+
from . import behavior
from .base import ContentLine, registerBehavior, backslashEscape
@@ -134,7 +136,7 @@ class VCardTextBehavior(behavior.Behavior):
line.encoding_param = cls.base64string
encoding = getattr(line, 'encoding_param', None)
if encoding:
- line.value = line.value.decode('base64')
+ line.value = codecs.decode(line.value.encode("utf-8"), "base64")
else:
line.value = stringToTextValues(line.value)[0]
line.encoded=False
@@ -147,7 +149,7 @@ class VCardTextBehavior(behavior.Behavior):
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")
else:
line.value = backslashEscape(line.value)
line.encoded=True
@@ -338,6 +340,7 @@ class OrgBehavior(VCardBehavior):
if obj.isNative:
return obj
obj.isNative = True
+ obj.value = splitFields(obj.value)
return obj
@staticmethod