[XML-SIG] "encoding" argument to xml.dom.minidom.toxml()?
janssen at parc.com
Wed Jun 11 18:14:36 CEST 2008
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. Instead, an exception is raised
from deep inside Python, which contains no indication of what piece of
input data caused it. And there's no need for that to happen. XML
can fully support any output encoding for any Unicode input stream,
and it should do that.
> Bill Janssen wrote:
> >> I suspect there's a certain amount of unarticulated assumptions on both
> >> sides of this exchange. I'm guessing that Bill might be thinking
> >> something like: "it's possible to represent any Unicode character in XML
> >> as &#<code-position-for character>"; and was hoping that the method
> >> would do just that for the non-ASCII characters if he asks for ASCII
> >> encoding.
> > Yep, that's what I was thinking. I don't see any other reason to have
> > that parameter there.
> Have you considered that it may be there to allow other encodings than UTF-8?
> Check the codecs module to see how many others there are.
More information about the XML-SIG