Hi,

ET being ElementTree in the following code, could anyone explain
why it fails ?

>>> xml = ET.tostring(ET.Element("root"), "UTF-16")
>>> xml
"<?xml version='1.0' encoding='UTF-16'?>\n<\xff\xfer\x00o\x00o\x00t\x00
/>"
>>> ET.fromstring(xml)
Traceback (most recent call last):
...
xml.parsers.expat.ExpatError: encoding specified in XML declaration is
incorrect: line 1, column 30

I s it related to the lack of BOM in the xml string ?
I tried to add some "\xff\xfe" or "\xfe\xff" at the start of the xml
string without much sucess with fromstring so far ...

Cheers,

SB

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to