[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: add_wch() prints garbage
From: |
Igor Liferenko |
Subject: |
Re: add_wch() prints garbage |
Date: |
Tue, 11 Apr 2017 15:23:10 +0700 |
Some testing results for comparison:
If instead of add_wch() we use addstr() with UTF-8 representation of
the wide character, everything works OK.
#include <ncursesw/curses.h>
#include <wchar.h>
#include <locale.h>
#include <stdlib.h>
#include <limits.h>
char add_wch_hack[MB_LEN_MAX+1];
int main(void)
{
setlocale(LC_CTYPE, "C.UTF-8");
initscr();
wchar_t c = L'ф';
add_wch_hack[wctomb(add_wch_hack, c)]='\0';
addstr(add_wch_hack);
refresh();
getch();
endwin();
return 0;
}
Regards,
Igor