I am trying to compile some unicode raw_input in the python default IDE, and as far as I know, this should be as simple as:
>>> c = raw_input() 日本語 >>> print c 日本語
However, when I try to enter Unicode characters, the computer beeps for some protests, and I get an empty string. (To do this, I click on the IME switch near the time and select the appropriate input method [which in this case is the Japanese input). Outside of the python IDE, the input works fine, I can enter characters, and the system recognizes them as incoming. In the IDE, I type some hiragana and the window for selecting a descending kanji will appear, as usual, but when I select the appropriate view and press enter, these sound signals come and I end up with nothing. I suppose there was a place somewhere that I missed.
:
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
and
Python 2.5.4 (r254:67916, Jun 24 2010, 21:47:25) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
none of them work. There also:
>>> import sys >>> sys.getdefaultencoding() 'ascii' >>> sys.stdin.encoding 'UTF-8' >>> sys.stdout.encoding 'UTF-8' >>> sys.getfilesystemencoding() 'utf-8'
but from what I read, the default coding is a mysterious beast. In any case, its change does not fix anything. I.e
>>> import sys >>> sys.setdefaultencoding('utf-8') Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'setdefaultencoding' >>> reload(sys) <module 'sys' (built-in)> >>> sys.setdefaultencoding('utf-8') >>>
does not work. Sounds even more. I cannot cut and paste Japanese text from other applications.