Serhiy Storchaka added the comment:
On Python 3 you should not only open file in text mode with specified encoding,
but also specify the "xmlcharrefreplace" error handler.
doc.writexml(open(filename, "w", encoding="utf-8",
errors="xmlcharrefreplace"), "", " ", "utf-8")
I can suggest only one solution -- explicitly document this behavior.
Perhaps we also should add a special module level function for writing DOM tree
to binary file. Low-level writexml() should not be used directly.
----------
nosy: +eli.bendersky, scoder, serhiy.storchaka
versions: +Python 3.3, Python 3.4
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18911>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com