Unicode string output
Michael Ströder
michael at stroeder.com
Sun Jan 21 12:22:11 EST 2001
Michael Hudson wrote:
>
> "Alexander Kostyrkin" <avkost66 at f4.dion.ne.jp> writes:
>
> > Surprisingly printing a unicode string that contains a Japanese kanji
> > character raises an exception
> > For example
> >
> > print u"\u55f4"
> > UnicodeError: ASCII encoding error: ordinal not in range(128)
> >
>
> print u"\u55f4".encode('kanji')
How about this?
>>> u"\u55f4".encode('utf-8')
'\345\227\264'
Ciao, Michael.
More information about the Python-list
mailing list