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

Ezio Melotti report at bugs.python.org
Sat Jan 9 08:29:56 EST 2016

Ezio Melotti 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.

Isn't this only required in case there are non encodable characters?
If the encoding is utf-8, this shouldn't be necessary (unless there are lone surrogates).  Specifying xmlcharrefreplace might be useful while using ascii or latin1 though.

The docs of writexml don't seem to specify if the file should be opened in text or binary mode but istm that only text mode is supported.  The advice of using xmlcharrefreplace could be added in a note.

nosy: +ezio.melotti
versions:  -Python 3.4

Python tracker <report at bugs.python.org>

More information about the docs mailing list