mscdex/node-ncurses — pull request #18 by tokuhirom (2012-07-27 01:01:51+00:00)
Title: call get_wch instead of getch

get_wch is required to support multi-byte unicode character input.

This is a example code:

var nc=require('../ncurses'),
sl=require('setlocale');
sl.setlocale(sl.LC_ALL, ''); // must first.

var w = new nc.Window(),
buf = '',
tmo;

process.on('SIGINT', function () {
nc.cleanup();
console.log(buf);
process.exit();
});
w.on('inputChar', function(c, x) {
buf += c;

w.clear();
w.cursor(0,0);
w.addstr(buf);
w.cursor(w.height-1,0);
w.addstr(''+x);
w.refresh();
});
w.refresh();
tmo = setTimeout(function() { w.close(); }, 10*1000);

Notes:
ncurses requires setlocale(3) to support unicode. node's setlocale module is a simple wrapper for setlocale(3).