0

I'm trying to enter multi-characters in an ncurses-application (e.g. accents, special characters):

I enter before that in the terminal: xmodmap -e "keycode 66 = Multi_key" and then: capslock e = (these 3 keys) gives an euro sign: € <- there you should see an euro sign, see https://en.wikipedia.org/wiki/Euro_sign

In the ncurses application I get garbage or the terminal seems to hang - I then need to press a couple of keys to-unhang it often that does not work.

#include <ncursesw/curses.h>

int main(int argc, char *argv[])
{
    setlocale(LC_ALL,"");
    initscr();
    start_color();
    use_default_colors();
    keypad(stdscr, TRUE);
    cbreak();
    intrflush(stdscr, FALSE);
    noecho();
    refresh();
    nodelay(stdscr, FALSE);
    meta(stdscr, TRUE);     /* enable 8-bit input */
    raw();  /* to be able to catch ctrl+c */
    leaveok(stdscr, TRUE);

    for(;;) {
            wint_t ch;
            if (get_wch(&ch) != ERR) {
                    wchar_t temp[] = { ch, 0x00 };
                    addwstr(temp);
            }
            else {
                    addwstr(L" {ERR} ");
            }
            refresh();
    }

    return 0;
}

Any ideas?

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
Folkert van Heusden
  • 433
  • 4
  • 17
  • 38
  • This is actually terminal-dependent, not relevant to ncurses. – Thomas Dickey Jun 22 '18 at 19:50
  • @ThomasDickey ok but how can I resolve it? – Folkert van Heusden Jun 22 '18 at 20:27
  • If I were only looking at ncurses, I'd check that the bytes read via `wgetch` matched my assumption about the terminal (ncurses can be compiled for debug-trace, but it's unnecessary for this issue). If I were testing xterm, I'd compile it for a debug-trace and look at that. With other terminals, it seems the developers don't do any of that. – Thomas Dickey Jun 22 '18 at 21:49

0 Answers0