xml and unicode problems
Martin v. Löwis
martin.vonloewis at hpi.uni-potsdam.de
Wed Mar 26 05:32:45 EST 2003
> File "menews.py", line 123, in normalize
> return escape(" ".join(result).strip())
> File "menews.py", line 69, in <lambda>
> escape = lambda x: xml.sax.saxutils.escape(x).encode('UTF-8')
> UnicodeDecodeError: 'ascii' codec can't decode byte 0x93 in position
> 0: ordinal not in range(128)
>
> Would appreciate any hints as to a solution, code available upon
> request.
It would be good if you could report the value of "result" in line 123.
It looks like you have some CP1252 data in there; 0x93 is
LEFT DOUBLE QUOTATION MARK (U+201C) in CP1252.
You should arrange to decode them to Unicode first before
encoding them as UTF-8.
Regards,
Martin
More information about the Python-list
mailing list