Issue 11649: startElementNS in xml.sax.saxutils.XMLGenerator ignored encoding (original) (raw)

Issue11649

Created on 2011-03-23 13:30 by gromgull, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
xmltest.py gromgull,2011-03-25 10:34
Messages (4)
msg131863 - (view) Author: Gunnar Aastrand Grimnes (gromgull) Date: 2011-03-23 13:30
The startElementNS method in the XMLGenerator ignores the encoding set. it does: self._out.write(' xmlns:%s="%s"' % (prefix, uri)) whereas it should have done: self._write(' xmlns:%s="%s"' % (prefix, uri)) Issue 938076 was similar to this, but for a different method.
msg131879 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2011-03-23 14:45
Do you have a test or a small script which shows the incorrect output?
msg132077 - (view) Author: Gunnar Aastrand Grimnes (gromgull) Date: 2011-03-25 10:34
I came across the bug when trying to write XML documents to StringIO objects. This does not work, since the output contains a mix of unicode and str objects, and StringIO gets confused. A better alternative is to use io.BytesIO, since all output should be encoded, but this also throws an error since it gets some unicode objects. The attached file breaks for both cases (comment/uncomment StringIO to test)
msg182120 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-02-14 21:13
Already fixed in .
History
Date User Action Args
2022-04-11 14:57:15 admin set github: 55858
2013-02-14 21:13:08 serhiy.storchaka set status: open -> closednosy: + serhiy.storchakamessages: + resolution: out of datestage: test needed -> resolved
2011-03-26 19:10:25 ezio.melotti set nosy: + ezio.melotti
2011-03-25 10:34:28 gromgull set files: + xmltest.pymessages: +
2011-03-23 14:45:21 amaury.forgeotdarc set nosy: + amaury.forgeotdarcmessages: + stage: test needed
2011-03-23 13:30:22 gromgull create