I'm attempting to add wchar_t Unicode characters to an ncurses display in C.
I have an array:
wchar_t characters[]={L'\uE030', L'\uE029'}; // containing 2 thai letters, for example
add_wch(characters[0]);
char characters[]={'A', 'B'};
// and later...
addch(characters[0]);
#include <locale.h>
// in main()
setlocale(LC_CTYPE,"C-UTF-8");
#include <ncurses.h>
gcc -o ncursesutf8 ncursesutf8.c -lm -lncurses -Wall -std=c99
ncursesutf8.c:48: warning: implicit declaration of function ‘add_wch’
addch
wchar_t []
L'\u0E30'
L"\u0E30"
addchar
The wide character support is handled by ncursesw. Depending on your distro, ncurses may or may not point there (seemingly not in yours).
Try using -lncursesw
instead of -lncurses
.
Also, for the locale, try calling setlocale(LC_ALL, "")