[Python-checkins] r57621 - python/branches/alex-py3k/Lib/xml/dom/minidom.py
alexandre.vassalotti
python-checkins at python.org
Tue Aug 28 20:24:20 CEST 2007
Author: alexandre.vassalotti
Date: Tue Aug 28 20:24:20 2007
New Revision: 57621
Modified:
python/branches/alex-py3k/Lib/xml/dom/minidom.py
Log:
Fix test_minidom.
Modified: python/branches/alex-py3k/Lib/xml/dom/minidom.py
==============================================================================
--- python/branches/alex-py3k/Lib/xml/dom/minidom.py (original)
+++ python/branches/alex-py3k/Lib/xml/dom/minidom.py Tue Aug 28 20:24:20 2007
@@ -48,8 +48,7 @@
def toprettyxml(self, indent="\t", newl="\n", encoding=None):
# indent = the indentation string to prepend, per level
# newl = the newline string to append
- use_encoding = "utf-8" if encoding is None else encoding
- writer = io.StringIO(encoding=use_encoding)
+ writer = io.StringIO()
if self.nodeType == Node.DOCUMENT_NODE:
# Can pass encoding only to document, to put it into XML header
self.writexml(writer, "", indent, newl, encoding)
@@ -58,7 +57,7 @@
if encoding is None:
return writer.getvalue()
else:
- return writer.buffer.getvalue()
+ return writer.getvalue().encode(encoding)
def hasChildNodes(self):
if self.childNodes:
More information about the Python-checkins
mailing list