what is this UnicodeDecodeError:....?

Steve Holden steve at holdenweb.com
Wed Oct 11 03:41:18 EDT 2006


John Machin wrote:
> Marc 'BlackJack' Rintsch wrote:
> 
> 
>>Because you are trying to compare a unicode string `val` with a byte
>>string in the list. The unicode string will be converted to a byte string
>>for this comparison with the default encoding: ASCII.
> 
> 
> :-)
> 
> I presume you must live north of the equator. Down under, it seems to
> happen the other way up -- the byte strings are decoded to unicode:
> 
> | >>> ['a', 'exotic1\xff', 'exotic2\xf3'].index(u'\xf3')
> | Traceback (most recent call last):
> |   File "<stdin>", line 1, in ?
> | UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position
> 7: ordinal not in range(128)
> 
> (-:
> 
I see you also use little-endian smileys in the antipodes.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list