Commit b92fe755 authored by Nicolas Delaby's avatar Nicolas Delaby

Return always string as str and unicode as unicode.

codec used for encoding is utf-8.
parent ce4b76b9
......@@ -440,14 +440,18 @@ class Unmarshaller(ElementTreeContentHandler):
def um_end_string(self, name):
ds = self.data_stack
# might need to convert unicode string to byte string
ds[-1] = unescape(''.join(ds[-1]))
value = unescape(''.join(ds[-1]))
if isinstance(value, unicode):
value = value.encode('utf-8')
ds[-1] = value
self.accumulating_chars = 0
def um_end_unicode(self, name):
ds = self.data_stack
# might need to convert unicode string to byte string
ds[-1] = unescape(''.join(ds[-1]))
value = unescape(''.join(ds[-1]))
if not isinstance(value, unicode):
value = value.decode('utf-8')
ds[-1] = value
self.accumulating_chars = 0
def um_end_int(self, name):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment