On Fri, 10 Feb 2006, Peter Samuelson wrote:
[Martin v. L?wis]
I also tried compiling/linking with ncursesw instead; this didn't
change anything.
Right, python Modules/_cursesmodule.c has no explicit support for
ncursesw functions.
as noted on the newsgroup discussion this week, python doesn't need
explicit support for ncursesw functions, but does need a change to its
setup.py to make it load ncursesw if it's available. Aside from adding
an interface for get_wch(), I don't think the other ncursesw-specific
functions are that useful to python.
The reason the python curses code displays "?" is purely accidental:
python believes it is sending *two* valid characters to ncurses, and
ncurses believes it is sending *two* valid characters to the terminal.
Both layers are mistaken.
As I discovered in tracing it, that's because python resets its locale to
POSIX (not even the correct locale - I was running the test in
en_US.UTF-8). I didn't dig deep enough to see why python did that, but
can't think of a plausible reason for it.
curses only displays what it believes to be valid characters, and this
seems to be based on ISO-8859. You might notice that "?" works and "?"
does not. (Try it!) In the ISO-8859 family, bytes 0x80-0xbf are
invalid - and the UTF-8 encoding of "?" is 0xc3 0x84.
Peter
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net