Re: ElementTree and utf-16 encoding

2006-12-19 Thread Sébastien Boisgérault
On Dec 19, 10:49 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Sébastien Boisgérault wrote: > > ET being ElementTree in the following code, could anyone explain > > why it fails ?I'm afraid the standard serializer in 1.2 only supports > > ASCII-compatible > encodings. this will be fixed in 1.3

Re: ElementTree and utf-16 encoding

2006-12-19 Thread Fredrik Lundh
Sébastien Boisgérault wrote: > ET being ElementTree in the following code, could anyone explain > why it fails ? I'm afraid the standard serializer in 1.2 only supports ASCII-compatible encodings. this will be fixed in 1.3. as a workaround, you can do: tostring(elem).decode("utf-8").enco

ElementTree and utf-16 encoding

2006-12-19 Thread Sébastien Boisgérault
Hi, ET being ElementTree in the following code, could anyone explain why it fails ? >>> xml = ET.tostring(ET.Element("root"), "UTF-16") >>> xml "\n<\xff\xfer\x00o\x00o\x00t\x00 />" >>> ET.fromstring(xml) Traceback (most recent call last): ... xml.parsers.expat.ExpatError: encoding specified in X