unicode in PythonWin's interactive window

Neil Hodgson nhodgson at bigpond.net.au
Thu May 3 08:11:15 EDT 2001


Francis Meyvis:

   Its very helpful when asking questions like this for you to reveal the
operating system and PythonWin versions you are using.

> Is there a way to show the real characters
> of a Unicode string in PythonWin's interactive window?

   Yes. Umm, you used to be able to but it doesn't work too well any more in
PythonWin 210. The editor in PythonWin runs in UTF-8 mode so can display
Unicode. If you try an earlier version of PythonWin, more of this may work.

   Some of the things you need to do include setting the display font to one
that includes the characters you want to see. On W2K, Tahoma is a good
choice and on NT4 MS Gothic will get you Japanese at least. To set the font
go to View | Options | Format | Default Font | Fixed Width. If you have
fixed font turned off then change the proportional setting just below the
above setting.

   You may need to munge the registry - search for the "Python for Win32"
key and under that will be Interactive Window with some font definitions
like "Courier". Change these (while PythonWin is closed so it doesn't
overwrite them, to the preferred font.

   You should now be able to type in Japanese characters using the Japanese
IME. Install the IME in the Input Locales part of the Control Panel
(possibly under Regional Settings although I can't recall for different
versions). Even without the IME, you can use the Character Map accessory and
the copy the characters into PythonWin.

   Now PythonWin will try to interpret the characters. It didn't before so
you used to be able to say 'print "Japanese string"' and it would do so, but
I think its grown too clever.

> Is there also a way to input Japanese characters easily in the interactive
> window?
> (aka Emacs input methods: to have the Japanese syllable 'ka' one must
> type the characters 'k' 'a' when using Japanese-hiragana input method).

   That is the job of the IME (Input Method Editor) which allows those of us
mostly ignorant of Japanese to type kawasaki and see some Japanese
characters.

   Neil





More information about the Python-list mailing list