Parsing XML with ElementTree (unicode problem?)

oren.tsur at gmail.com oren.tsur at gmail.com
Tue Jul 24 10:30:04 EDT 2007


> How about trying
> root = ElementTree.parse(urlopen(query), encoding ='utf-8')
>

this specific thing is not working, however, parsing the url is not
problematic. the problem is that after parsing the xml at the url I
save some of the fields to a local file and the local file is not
being parsed properly due to the non-ascii characters Sauni\xc3\xa8re
(french name: Saunière).

an example of the file can be found in the first posting, you could
copy+paste+save it to your machine then try to parse it.

I'm quite new to xml and python so I guess there must be something
wrong or dumb in the way I save the file (maybe I miss some important
tags?) or in the way I re-open it but I can't find whats wrong.





More information about the Python-list mailing list