[lxml-dev] clean_html

Stefan Behnel stefan_ml at behnel.de
Thu Jun 25 08:36:53 CEST 2009


Francesco wrote:
> What should I do if I want to save to disk my data?
> 
> I am using etree.parse and also etree.xpath...

XPath is not related to parsing or serialising.


> but I always have encoding problems...

On parsing or on serialising? And what kind of problem?


> Is it possible to set the encoding to the same that was used by the 
> parser?

You can check if the ElementTree object returned by parse() has something
useful in its ".docinfo.encoding" property.

But why not use UTF-8 on output in general?

Stefan


More information about the lxml-dev mailing list