Browse Source

Fix the Python 3 support of pretty_xml

Guillaume Ayoub 14 years ago
parent
commit
5ea41e5f4b
1 changed files with 3 additions and 2 deletions
  1. 3 2
      radicale/xmlutils.py

+ 3 - 2
radicale/xmlutils.py

@@ -86,8 +86,9 @@ def _pretty_xml(element, level=0):
         if level and (not element.tail or not element.tail.strip()):
             element.tail = i
     if not level:
-        return '<?xml version="1.0"?>\n' + ET.tostring(
-            element, config.get("encoding", "request"))
+        output_encoding = config.get("encoding", "request")
+        return ('<?xml version="1.0"?>\n' + ET.tostring(
+            element, "utf-8").decode("utf-8")).encode(output_encoding)
 
 
 def _tag(short_name, local):