Serhiy Storchaka <storch...@gmail.com> added the comment: Oh, I see XMLGenerator completely outdated. It even has not been ported to Python 3. See function _write:
def _write(self, text): if isinstance(text, str): self._out.write(text) else: self._out.write(text.encode(self._encoding, _error_handling)) In Python 2 there was a choice between bytes and unicode strings. But in Python 3 encoding never happens. XMLGenerator does not distinguish between binary and text streams. Here is a patch that fixes the work of XMLGenerator in Python 3. Unfortunately, it is impossible to avoid the loss of backward compatibility. I tried to keep the code to work for the most common cases, but some code which "worked" before may break (including I had to correct some tests). ---------- Added file: http://bugs.python.org/file25760/XMLGenerator.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue1470548> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com