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

Iñigo Serna inigoserna at gmail.com
Thu Aug 20 12:36:05 EDT 2009


Hello,

I have the same problem mentioned in
http://groups.google.com/group/comp.lang.python/browse_thread/thread/c70c80cd9bc7bac6?pli=1some
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 ç
character.

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?


Thanks,
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: <http://mail.python.org/pipermail/python-list/attachments/20090820/8cba304a/attachment.html>


More information about the Python-list mailing list