[issue3075] make minidom.toxml() encoding argument useful
Mark Lawrence breamore...@yahoo.co.uk added the comment: Closing as no response to msg111607. -- resolution: - out of date status: pending - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3075 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3075] make minidom.toxml() encoding argument useful
Mark Lawrence breamore...@yahoo.co.uk added the comment: This is how toprettyxml looks in 3.1/2 which seems to meet the OP's need, I'll close in a few days time unless someone objects. def toprettyxml(self, indent=\t, newl=\n, encoding=None): # indent = the indentation string to prepend, per level # newl = the newline string to append use_encoding = utf-8 if encoding is None else encoding writer = codecs.getwriter(use_encoding)(io.BytesIO()) if self.nodeType == Node.DOCUMENT_NODE: # Can pass encoding only to document, to put it into XML header self.writexml(writer, , indent, newl, encoding) else: self.writexml(writer, , indent, newl) if encoding is None: return writer.stream.getvalue().decode(use_encoding) else: return writer.stream.getvalue() -- nosy: +BreamoreBoy status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3075 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3075] make minidom.toxml() encoding argument useful
Éric Araujo mer...@netwok.org added the comment: Is this still relevant for 3.2? -- nosy: +merwok versions: +Python 3.3 -Python 2.6, Python 3.0 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3075 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3075] make minidom.toxml() encoding argument useful
Changes by Éric Araujo mer...@netwok.org: -- versions: +Python 3.2 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3075 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3075] make minidom.toxml() encoding argument useful
New submission from Bill Janssen [EMAIL PROTECTED]: Right now, the encoding argument added to xml.dom.minidom.DOMObject.toxml() in Python 2.3 seems fairly useless. It has to be UTF-8. But a one-line change to the implementation of toprettyxml would make it useful; instead of the encoding error method being strict, make it xmlcharrefreplace. So change writer = codecs.lookup(encoding)[3](writer) to writer = codecs.lookup(encoding)[3](writer, xmlcharrefreplace) -- components: Library (Lib) keywords: easy messages: 67909 nosy: janssen priority: normal severity: normal status: open title: make minidom.toxml() encoding argument useful versions: Python 2.6, Python 3.0 ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3075 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3075] make minidom.toxml() encoding argument useful
Bill Janssen [EMAIL PROTECTED] added the comment: The method toxml is actually on xml.dom.minidom.Node. -- type: - feature request ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3075 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com