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

2009-08-21 Thread Thomas Dickey
On Fri, 21 Aug 2009, Iñigo Serna wrote: 2009/8/21 Thomas Dickey : On Aug 20, 6:12 pm, Iñigo Serna wrote:     c = win.getch() You're using "getch", not "get_wch" (Python's ncurses binding may/may not have the latter). curses getch returns 8-bit values, get_wch would return wider values.

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

2009-08-21 Thread Iñigo Serna
2009/8/21 Thomas Dickey : > On Aug 20, 6:12 pm, Iñigo Serna wrote: >>     c = win.getch() > > You're using "getch", not "get_wch" (Python's ncurses binding may/may > not have the latter). > curses getch returns 8-bit values, get_wch would return wider values. you are right, ncurses binding do

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

2009-08-21 Thread Thomas Dickey
On Aug 20, 6:12 pm, Iñigo Serna wrote: > Hi again, > > 2009/8/20 Iñigo Serna > > I have the same problem mentioned > > inhttp://groups.google.com/group/comp.lang.python/browse_thread/thread/...some > > months ago. > > > Python 2.6 program which usesncursesmodule in a terminal configured to use

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

2009-08-20 Thread Iñigo Serna
Hi again, 2009/8/20 Iñigo Serna > > I have the same problem mentioned in > http://groups.google.com/group/comp.lang.python/browse_thread/thread/c70c80cd9bc7bac6?pli=1 > some months ago. > > Python 2.6 program which uses ncurses module in a terminal configured to use > UTF-8 encoding. > > When

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

2009-08-20 Thread Iñigo Serna
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

Re: decoding keyboard input when using curses

2009-05-31 Thread Chris Jones
On Sun, May 31, 2009 at 02:30:54PM EDT, Arnaud Delobelle wrote: > Chris Jones writes: > [...] > > Try this: > > > > #include > > #include > > #include > > #include > > #include > > /* Here I need to add the following include to get wint_t on macOS X*/ > > #include Ah.. interesting. My p

Re: decoding keyboard input when using curses

2009-05-31 Thread Arnaud Delobelle
Chris Jones writes: [...] > Try this: > > #include > #include > #include > #include > #include /* Here I need to add the following include to get wint_t on macOS X*/ #include > > int ct; > wint_t unichar; > > int main(int argc, char *argv[]) > { > setlocale(LC_ALL, "");

Re: decoding keyboard input when using curses

2009-05-31 Thread Chris Jones
On Sun, May 31, 2009 at 04:05:20AM EDT, Arnaud Delobelle wrote: [..] > Thanks for this. When I test it on my machine (BTW it is MacOS 10.5.7), > if I type an ASCII character (e.g. 'A'), I get its ASCII code (0x41), > but if I type a non-ascii character (e.g. '§') I get back to the prompt > immed

Re: decoding keyboard input when using curses

2009-05-31 Thread Arnaud Delobelle
Chris Jones writes: Hi Chris, thanks for your detailed reply. > On Sat, May 30, 2009 at 04:55:19PM EDT, Arnaud Delobelle wrote: > >> Hi all, > > Disclaimer: I am not familiar with the curses python implementation and > I'm neither an ncurses nor a "unicode" expert by a long shot. > > :-) > >> I

Re: decoding keyboard input when using curses

2009-05-30 Thread Chris Jones
On Sat, May 30, 2009 at 04:55:19PM EDT, Arnaud Delobelle wrote: > Hi all, Disclaimer: I am not familiar with the curses python implementation and I'm neither an ncurses nor a "unicode" expert by a long shot. :-) > I am looking for advice on how to use unicode with curses. First I will > explai

Re: decoding keyboard input when using curses

2009-05-30 Thread Arnaud Delobelle
Arnaud Delobelle writes: [...] > I can pipe the stream of output from getch() directly through an ^^^ I mean *can't* > instance of codecs.getreader('utf-8') because getch() sometimes returns > the integer values of the 'special keys'. [...] I reread my post 3 times before sending it, honest!

decoding keyboard input when using curses

2009-05-30 Thread Arnaud Delobelle
Hi all, I am looking for advice on how to use unicode with curses. First I will explain my understanding of how curses deals with keyboard input and how it differs with what I would like. The curses module has a window.getch() function to capture keyboard input. This function returns an integer