Commit 2467311d authored by Christian Ledermann's avatar Christian Ledermann

always decode strings to UTF8

parent e2a563f2
...@@ -143,9 +143,10 @@ class Link(object): ...@@ -143,9 +143,10 @@ class Link(object):
""" Return the ATOM Object as serialized xml """ """ Return the ATOM Object as serialized xml """
if LXML and prettyprint: if LXML and prettyprint:
return etree.tostring(self.etree_element(), encoding='utf-8', return etree.tostring(self.etree_element(), encoding='utf-8',
pretty_print=True) pretty_print=True).decode('UTF-8')
else: else:
return etree.tostring(self.etree_element(), encoding='utf-8') return etree.tostring(self.etree_element(),
encoding='utf-8').decode('UTF-8')
class _Person(object): class _Person(object):
...@@ -218,9 +219,10 @@ class _Person(object): ...@@ -218,9 +219,10 @@ class _Person(object):
""" Return the ATOM Object as serialized xml """ """ Return the ATOM Object as serialized xml """
if LXML and prettyprint: if LXML and prettyprint:
return etree.tostring(self.etree_element(), encoding='utf-8', return etree.tostring(self.etree_element(), encoding='utf-8',
pretty_print=True) pretty_print=True).decode('UTF-8')
else: else:
return etree.tostring(self.etree_element(), encoding='utf-8') return etree.tostring(self.etree_element(),
encoding='utf-8').decode('UTF-8')
class Author(_Person): class Author(_Person):
""" Names one author of the feed/entry. A feed/entry may have """ Names one author of the feed/entry. A feed/entry may have
......
...@@ -70,6 +70,7 @@ class _BaseObject(object): ...@@ -70,6 +70,7 @@ class _BaseObject(object):
""" Return the KML Object as serialized xml """ """ Return the KML Object as serialized xml """
if config.LXML and prettyprint: if config.LXML and prettyprint:
return etree.tostring(self.etree_element(), encoding='utf-8', return etree.tostring(self.etree_element(), encoding='utf-8',
pretty_print=True) pretty_print=True).decode('UTF-8')
else: else:
return etree.tostring(self.etree_element(), encoding='utf-8') return etree.tostring(self.etree_element(),
encoding='utf-8').decode('UTF-8')
...@@ -105,9 +105,10 @@ class KML(object): ...@@ -105,9 +105,10 @@ class KML(object):
""" Return the KML Object as serialized xml """ """ Return the KML Object as serialized xml """
if config.LXML and prettyprint: if config.LXML and prettyprint:
return etree.tostring(self.etree_element(), encoding='utf-8', return etree.tostring(self.etree_element(), encoding='utf-8',
pretty_print=True) pretty_print=True).decode('UTF-8')
else: else:
return etree.tostring(self.etree_element(), encoding='utf-8') return etree.tostring(self.etree_element(),
encoding='utf-8').decode('UTF-8')
def features(self): def features(self):
""" iterate over features """ """ iterate over features """
......
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