STINNER Victor added the comment:

> Applied to 3.3 and 3.4.  I'll leave this issue open
> for a week so that Victor can comment on Unicode/wide-characters.

I don't know (n)curses, but I tried to improve the curses module of Python. I 
added an encoding attribute which is the locale encoding by default, so it 
should work without special configuration. But it's good to know what the 
default encoding is. (It was UTF-8 on older Python 3 release, maybe in Python < 
3.3.)

I also added functions like unget_wch() and get_wch().

The problem is that unget_wch() and get_wch() are not always available, it 
depends on the platform. If I remember correctly, it depends if libreadline is 
linked to libncursesw (and not libncurses).

Ah yes, and the Python curses modules uses Unicode versions of C curses 
functions if available. It is still possible to use thes bytes versions if you 
pass bytes strings. For example:

 * window.addstr("abc"): use *add_wstr() functions if available, *addstr() 
otherwise
 * window.addstr(b"abc"): always use *addstr() functions

I don't know enough the C libncursesw library to write an HOWTO or something 
like that.

I just would like to say that you should prefer get_wch() over getch() if 
get_wch() is available. But I don't understand exactly how curses behave with 
control characters ("keys"?) like "up" or "left".

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17700>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to