Need debugging knowhow for my creeping Unicodephobia

kj no.email at please.post
Thu Feb 11 12:37:27 EST 2010



In <mailman.2379.1265906673.28905.python-list at python.org> mk <mrkafk at gmail.com> writes:

>To make matters more complicated, str.encode() internally DECODES from 
>string into unicode:

> >>> nu
>'\xc4\x84'
> >>>
> >>> type(nu)
><type 'str'>
> >>> nu.encode()
>Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 0: 
>ordinal not in range(128)

>There's logic to this, although it makes my brain want to explode. :-)


Thanks for pointing this one out!  It could have easily pushed my
Unicodephobia into the incurable zone...

~K



More information about the Python-list mailing list