xml.dom.minidom character encoding

C. Benson Manica cbmanica at gmail.com
Wed Apr 21 20:03:27 CEST 2010


On Apr 21, 1:58 pm, Peter Otten <__pete... at web.de> wrote:
> C. Benson Manica wrote:
>> (snip)
>
> It seems that parseString() doesn't like unicode

Yes, I noticed that, and I already tried...

> -- let's try a byte string
> then:
>
> >>> doc = xml.dom.minidom.parseString(s.encode("utf-8"))
> >>> xml = doc.toxml(encoding="utf-8")

...except that it didn't work:

  File "./demo.py", line 8, in <module>
    doc=xml.dom.minidom.parseString( str.encode("utf-8") )
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
62: ordinal not in range(128)



More information about the Python-list mailing list