I coded the following snippet:
#include <locale.h>
#include <ncurses.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int uc;
int main(void)
{
initscr();
raw();
keypad(stdscr, TRUE);
uc = getch();
mvprintw(24, 0, "Key code = %4x ", uc);
refresh();
getch();
endwin();
return 0;
}
This runs OK when locale is set to en_US but behaves unexpectedly when
set to en_US.utf8.
I tested on uxterm with:
Compose + E=
which is mapped to the euro symbol - 0x20ac.
When I enter this key combination, I am returned to the bash prompt with
an empty square/rectangle.
This runs OK if I hit any key that's mapped to an 8-bit encoded
character such as <space> .. 0, 1, .. etc.
Is this because there's something wrong with my testing, using the
Compose key or do I need to change the code above to get it to work in
a UTF-8 locale?
I played with the above, adding a setlocale(LC_ALL, "") .. linked to
libncursesw instead of linbncurses.. to no effect.
Since I saw no mention of UTF-8 in the ncurses manuals I was expecting
this to be transparent.
CJ