Reputation: 1
I' trying to use ncurses on Windows in C and wanted to use some UTF-8 Characters.
What I've tried so far:
compiled in termux it's enough to use it like this and link it with -lncursesw
:
#include <stdio.h>
#include <wchar.h>
#include <ncurses.h>
int main(int argc, char **argv)
{
initscr();
cbreak();
refresh();
mvaddstr(1, 0, "\xe2\x9c\x93");
mvaddstr(2,0, "\xe2\x97\x8b");
mvaddstr(3,0, "\xe2\x97\x8f");
mvaddstr(4,0, "\xe2\x97\xaf");
refresh(); //print screen
getch(); //keep window open
endwin();
return 0;
}
Everything is as expected. But on Windows in doesn't work.
To print unicode in Windows Powershell I needed to set the to set SetConsoleOutputCP(CP_UTF8);
explicite:
#include <stdio.h>
#include <Windows.h>
int main(void)
{
SetConsoleOutputCP(CP_UTF8);
printf("%s", "\xe2\x9c\x93");
return 0;
}
But it doesn't work in combination with ncurses (it also not prints unicode characters). I tried it also with setlocale. Nothing helps.
Any suggestions?
Upvotes: 0
Views: 43