ncurses getch & unicode (was: decoding keyboard input when using curses)

Iñigo Serna inigoserna at
Thu Aug 20 18:36:05 CEST 2009


I have the same problem mentioned in
months ago.

Python 2.6 program which uses ncurses module in a terminal configured to use
UTF-8 encoding.

When trying to get input from keyboard, a non-ascii character (like ç) is
returned as 2 integers < 255, needing 2 calls to getch method to get both.
These two integers \xc3 \xa7 forms the utf-8 encoded representation of ç

ncurses get_wch documentation states the function should return an unique
integer > 255 with the ordinal representation of that unicode char encoded
in UTF-8, \xc3a7.

[Please, read the link above, it explains the issue much better that what I
could do.]

Any idea or update on this?

Iñigo Serna

PS: my system is a Linux Fedora 11 x86_64. Same happens on console,
gnome-terminal or xterm.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list