[issue18911] minidom does not encode correctly when calling Document.writexml

Brian Vanderburg report at bugs.python.org
Tue Sep 3 07:36:59 CEST 2013


New submission from Brian Vanderburg:

When I have unicode data to save, it seems that it does not save correctly, giving an encode error. I know this exists on 2.7 and from checking the code in xml/dom/minidom.py it looks like it does in 3.2 as well.

The method call that seem to be problematic is doc.writexml(open(filename, "wb"), "", "  ", "utf-8")

Currently I found this to work: doc.writexml(codecs.open(filename, "w", "utf-8"), "", "  ", "utf-8")

It seems like this should be handled by the writexml method since it already has the specified encoding.

----------
components: XML
messages: 196824
nosy: brianvanderburg2
priority: normal
severity: normal
status: open
title: minidom does not encode correctly when calling Document.writexml
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18911>
_______________________________________


More information about the Python-bugs-list mailing list