Search code examples
unicodencurses

How to print UTF-8 chars in ncurses?


Traditionally I can perfectly print this:

char str[] = "▄█▀█████";
printf(str); 

However, under ncurses I cannot print this string neither with:

mvprintw(0, 0, str);

nor with:

mvaddwstr(0,0, L"▄█▀█████");

What's my mistake?


Solution

  • Whooh, this was quick... I already solved it; dear nowox:

    You forgot to configure your locales:

    #include <locale.h>
    
    setlocale(LC_ALL, "");