Sebastian Ortiz Vasquez added the comment: I have been working with this in order to generate an RSS feed using web2py.
I found, XMLGenerator method does not validate if is an unicode or string type, and it does not encode accord the encoding parameter of the XMLGenerator. I added changed the method to verify if is an unicode object or try to convert to it using the desired encoding. Recall that the _write UnbufferedTextIOWrapper receives an unicode object as parameter. def characters(self, content): if isinstance(content, unicode): self._write(escape(content)) else: self._write(escape(unicode(content,self._encoding))) ---------- nosy: +neoecos title: Bugfix for #1470540 (XMLGenerator cannot output UTF-16) -> Bugfix for #1470540 (XMLGenerator cannot output UTF-16 or UTF-8) versions: -Python 3.2, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file29623/saxutils.py _______________________________________ 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