mscdex / node-ncurses

An ncurses binding for node.js
MIT License
386 stars 25 forks source link

support unicode #15

Closed moechofe closed 11 years ago

moechofe commented 12 years ago

Is it possible to display unicode characters using wchar ?

mscdex commented 12 years ago

Unicode support should already be available since the addon is being linked with ncursesw. If it's not working for you, you might check the env vars LC_ALL and/or LANG (assuming the locale you have set to those env vars is already created OR LC_ALL is not set).

moechofe commented 12 years ago

I found "ranlib ../lib/libncursesw.a" in the log during the compilation. Is it good? And my settings is:

LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_ALL=
tokuhirom commented 12 years ago

ncursesw's unicode support needs

setlocale(LC_ALL, "");

to initialize C library's locale support.

And, some of the functions should migrate to support unicode. getch() is not support unicode, you need to use get_wch() to take a unicode char.

tokuhirom commented 12 years ago

I'm using this silly patch for my personal use. https://github.com/tokuhirom/node-ncurses/commit/08e442d0ca7cdb7e18966e083b3a7573a34d1539

tokuhirom commented 12 years ago

setlocale(3) is required to support unicode, so my node-setlocale module can call setlocale(3). https://github.com/tokuhirom/node-setlocale/