Iterating over unicode strings
Arun Sharma
arun at sharma-home.net
Mon Mar 11 01:14:04 EST 2002
On Sun, Mar 10, 2002 at 10:48:44PM -0600, Jason Orendorff wrote:
> 1. Your unicode string might be wrong.
>
> Python doesn't know the encoding of your program,
> unfortunately, so it assumes ASCII. Anything that's
> not ASCII causes an error. To fix this, specify the
> encoding:
>
> line = unicode("??????|| ?????????????????? ???????????????", 'utf-8')
>
> 2. print won't work. :(
>
> Python doesn't know the encoding of your terminal,
> unfortunately, so it assumes ASCII. Any output that's
> not ASCII causes an error. To fix this, specify the
> encoding:
>
> print c.encode('utf-8')
>
> Hope this helps.
Thanks, that solved the problem.
-Arun
More information about the Python-list
mailing list