[lxml-dev] UTF-8 not supported

Alexander Shigin shigin at rambler-co.ru
Mon May 25 18:01:00 CEST 2009


В Пнд, 25/05/2009 в 10:54 -0500, Ovnicraft пишет:
> Hi folks, when do this, encoding='iso-8859-1' write xml enconding ok,
> but when try the same thing with 'UTF-8', not appears in my file, i
> have 2.2 version.
> How i can encoding my file with utf-8?

Can you give your code snippet? UTF-8 works fine for me.

Here is an example:
In [6]: print etree.tostring(etree.Element(unicode('ыъъ', 'utf-8')), encoding='utf-8')
<ыъъ/>

If you haven't got cyrillic letters:
In [9]: etree.tostring(etree.Element(u'\u044b\u044a\u044a'), encoding='utf-8')
Out[9]: '<\xd1\x8b\xd1\x8a\xd1\x8a/>'





More information about the lxml-dev mailing list