From 5ea41e5f4b0e4b4ce76741ea4f726fdbc13a40a7 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Wed, 20 Jul 2011 23:14:00 +0200 Subject: [PATCH] Fix the Python 3 support of pretty_xml --- radicale/xmlutils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/radicale/xmlutils.py b/radicale/xmlutils.py index 78766d70..e1f63d5c 100644 --- a/radicale/xmlutils.py +++ b/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 '\n' + ET.tostring( - element, config.get("encoding", "request")) + output_encoding = config.get("encoding", "request") + return ('\n' + ET.tostring( + element, "utf-8").decode("utf-8")).encode(output_encoding) def _tag(short_name, local):