error when parsing xml

Albert Leibbrandt albert at compuscan.co.za
Mon Sep 5 08:46:30 EDT 2005


>> I use xml.dom.minidom to parse some xml, but when input
>> contains some specific caracters(æ, ø and å), I get an
>> UnicodeEncodeError, like this:
>>
>> UnicodeEncodeError: 'ascii' codec can't encode character
>> u'\xe6' in position 604: ordinal not in range(128).
>>
>> How can I avoid this error?
>>
>>
>> All help much appreciated!

I have found that some people refuse to stick to standards, so whenever I
parse XML files I remove any characters that fall in the range 
<= 0x1f
>= 0xf0

Hope it helps.

Regards
Albert





More information about the Python-list mailing list