UnicodeDecodeError

Ken Seehart ken at seehart.com
Sat Jul 21 23:07:24 CEST 2007


Um, never mind.  The recent unicode conversation gave me my answer  :-)
unicode(s, 'Windows-1252')

Ken Seehart wrote:
> I get this whenever I encounter a non-ascii character in a non-unicode 
> string:
>
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xd1 in position 23: 
> ordinal not in range(128)
>
> The string in question is "... ESPA\xd1OL ..."
>
> I completely understand why I get the error, and my solution will be to 
> simply convert to unicode (since the code that uses the string is 
> unicode ready).
>
> I am wondering if anyone knows where I can find a mapping from this 
> particular extended ascii code (where \xd1 is Ñ), to the corresponding 
> unicode characters.
>
> Ken
>
>
>   




More information about the Python-list mailing list