Message20545
When XMLGenerator is supplied with an encoding such as
'utf-8' and subsequently with some non-ASCII Unicode
characters, it crashes, because of its characters()
method. The current version is:
def characters(self, content):
self._out.write(escape(content))
This completely ignores the encoding, and will (when
writing to something such as a StringIO or the like)
simply try to convert this into an ASCII string. The
encoding is only used in the XML header, not as the
real encoding!
It may be that I've gotten things wrong, but I would
suggest the following fix:
def characters(self, content):
self._out.write(escape(content).encode(self._encoding))
This seems to work well for me, at least. |
|
Date |
User |
Action |
Args |
2007-08-23 14:21:06 | admin | link | issue938076 messages |
2007-08-23 14:21:06 | admin | create | |
|