Unicode problem

Shaun Pen jinushaun at hotmail.com
Sat Jun 9 16:03:39 EDT 2001


I'm writing a script that translates romaji to the appropriate hiragana or 
katakan characters. This is Japanese, btw.

>From the unicode website, I find that the character code for the hiragana 
"NA" is "306a" (JIS). I know it outputs as ‚È (JIS).

**So how do I get from "306a" to ‚È ??? **

In Javascript, document.write("\u306a") outputs ‚È correctly.

When I try that in Python (print u"\u306a"), I get the error:
  UnicodeError: ASCII encoding error: ordinal not in range(128)

I've also tried printing u"\u0030\u006a" and  u"\30\6a", but those give me 
the wrong thing.

All the docs I've read only deal with Latin encoding, which fall in the 
0-127 range nicely. And they deal with mostly u"äöü" to u"\344\366\374", 
instead of the other way around.

Please help. Sorry if this is long. I'm trying to avoid people screaming 
RTFM.

Jinushaun
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com





More information about the Python-list mailing list