quick unicode Q

Damjan gdamjan at gmail.com
Thu Dec 15 11:32:27 EST 2005


>> Read it as a string, and then decode it with the .decode method.  You
>> specify what encoding it's in.
>
> Most probably, the OP is asking what to do with an UTF-8 encoded string.
>
> To decode that, just use:
>
> s.decode("utf-8")

I prefer:

unicode(s, 'utf-8')

That way it's more clear that what you get is a unicode object.




More information about the Python-list mailing list