classification
Title: minidom Node.writexml method doesn't manage encoding parameter correctly
Type: Stage:
Components: Documentation, XML Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Goffi, docs@python, georg.brandl, loewis
Priority: normal Keywords:

Created on 2010-12-27 15:36 by Goffi, last changed 2010-12-28 11:16 by georg.brandl. This issue is now closed.

Files
File name Uploaded Description Edit
test_minidom.py Goffi, 2010-12-27 15:36 unicode error with minidom
Messages (5)
msg124709 - (view) Author: Goffi (Goffi) Date: 2010-12-27 15:36
G'day,

While translating my software to french, I realised that minidom's writexml method doesn't handle "encoding" parameter correctly: it changes the header of the resulting xml, but not the encoding itself (which it should according to the documentation: http://docs.python.org/library/xml.dom.minidom.html).

The given example doesn't work with writexml; but if I save by myself using the toxml's encoding parameter (like in the commented line), it works as expected.

Anyway, it would be better if minidom could handle unicode string directly.
msg124710 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-12-27 16:02
The documentation is incorrect; writexml does not support an encoding parameter. Only Document nodes support the encoding parameter in writexml, and it is intentional that its only effect is to fill out the XML declaration.

I don't understand the last sentence in your report: what is it that you want to see supported, and how is that related to this issue?
msg124711 - (view) Author: Goffi (Goffi) Date: 2010-12-27 16:07
Thanks for your quick reply

The last sentence has nothing to do with the report, it was just a general remark that it would be nice if minidom could support unicode string directly.

Should I send a mail to docs@python.org to report the doc issue, or this one is sufficient ?
msg124716 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-12-27 17:05
> The last sentence has nothing to do with the report, it was just a general remark that 
> it would be nice if minidom could support unicode string directly.

minidom most certainly supports Unicode directly. All element names,
attribute names, and text nodes carry Unicode objects.

> Should I send a mail to docs@python.org to report the doc issue, 
> or this one is sufficient ?

This one is sufficient.
msg124785 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-12-28 11:16
Fixed in r87532.
History
Date User Action Args
2010-12-28 11:16:20georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg124785

resolution: fixed
2010-12-27 17:05:52loewissetmessages: + msg124716
2010-12-27 16:07:02Goffisetmessages: + msg124711
2010-12-27 16:02:30loewissetnosy: + loewis, docs@python
messages: + msg124710

assignee: docs@python
components: + Documentation
2010-12-27 15:36:06Gofficreate