> Stefan, I think we are talking past each other. I know it's there to > allow encodings other than UTF-8, and I'm familiar with the codecs > module, and I like the parameter, in general. The problem is that if > you ignore the documentation, which seems to know that it's broken, > and specify an encoding other than UTF-8, the generated XML sometimes > doesn't conform to that encoding.
Can you give an example? I'm unable to reproduce the behavior you are seeing; it works just fine for me: py> import xml.dom.minidom py> d=xml.dom.minidom.getDOMImplementation().createDocument(None,"root",None) py> t=d.createTextNode(u"\u20ac") py> x=d.documentElement.appendChild(t) py> d.toxml(encoding="iso-8859-15") '<?xml version="1.0" encoding="iso-8859-15"?><root>\xa4</root>' AFAICT, this is the correct byte string. Can you give an example where toxml returns an incorrect byte string? Regards, Martin _______________________________________________ XML-SIG maillist - XML-SIG@python.org http://mail.python.org/mailman/listinfo/xml-sig