Unicode string output

Michael Hudson mwh21 at cam.ac.uk
Sun Jan 21 11:44:41 EST 2001


"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)
> 

Try

print u"\u55f4".encode('kanji')

though I don't know what should go in the place of 'kanji' - in fact,
I don't know if Python 2.0 shipped with any japanese codecs at all.

Not much help, I know...

Cheers,
M.

-- 
  languages shape the way we think, or don't.
                                        -- Erik Naggum, comp.lang.lisp



More information about the Python-list mailing list