diff options
author | Guido van Rossum <guido@python.org> | 2007-08-07 23:03:33 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-08-07 23:03:33 (GMT) |
commit | 55b15c9f059b3a22d03159296b1a5187df6489a6 (patch) | |
tree | fc23783c163dfc2b27dbe321f0ade917f63e1c28 /Lib/xml/dom | |
parent | bdba5cf69478c82b3f8f644e52e6b6ca7d474b97 (diff) | |
download | cpython-55b15c9f059b3a22d03159296b1a5187df6489a6.zip cpython-55b15c9f059b3a22d03159296b1a5187df6489a6.tar.gz cpython-55b15c9f059b3a22d03159296b1a5187df6489a6.tar.bz2 |
Fix the test_minidom failure.
We just need to force the encoding when no encoding is passed to toxml()
or toprettyxml(), rather than relying on the default encoding (which is
unreliable).
Diffstat (limited to 'Lib/xml/dom')
-rw-r--r-- | Lib/xml/dom/minidom.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/xml/dom/minidom.py b/Lib/xml/dom/minidom.py index d380022..fb57d58 100644 --- a/Lib/xml/dom/minidom.py +++ b/Lib/xml/dom/minidom.py @@ -48,7 +48,8 @@ class Node(xml.dom.Node): def toprettyxml(self, indent="\t", newl="\n", encoding=None): # indent = the indentation string to prepend, per level # newl = the newline string to append - writer = io.StringIO(encoding=encoding) + use_encoding = "utf-8" if encoding is None else encoding + writer = io.StringIO(encoding=use_encoding) if self.nodeType == Node.DOCUMENT_NODE: # Can pass encoding only to document, to put it into XML header self.writexml(writer, "", indent, newl, encoding) |