[lxml-dev] Encoding again
Stefan Behnel
stefan_ml at behnel.de
Mon Aug 25 04:42:08 CEST 2008
Hi,
Max Ivanov wrote:
> Is there any way to force lxml to make element.text and element.tail
> to be exactly the same as in original text, without any encoding
> manipulation? Or to restore them to original state, i.e. maybe
> somewhere inside lxml there is a var which contain original encoding,
> so I could do elelemt.text.encode('...').?
I'm not sure I understand what you want, but in case you want lxml.etree to
return the encoded byte string instead of the unicode string: no, there is no
switch to do that. I have no idea why you would want to do that, though.
The original encoding is stored in the docinfo property of the ElementTree of
the document.
Stefan
More information about the lxml-dev
mailing list