fix unicode on windows. see #130.

This commit is contained in:
Christopher Jeffrey 2015-04-27 00:19:55 -07:00
parent f37a619cc6
commit a42631cbc7

View File

@ -2138,6 +2138,11 @@ Tput.prototype.GetConsoleCP = function() {
return -1;
}
// Allow unicode on all windows consoles for now:
if (+process.env.NCURSES_UNICODE !== 0) {
return 65001;
}
try {
// Produces something like: 'Active code page: 437\n\n'
ccp = cp.execFileSync(process.env.WINDIR + '\\system32\\chcp.com', [], {
@ -2157,11 +2162,6 @@ Tput.prototype.GetConsoleCP = function() {
ccp = +ccp[0];
// Allow unicode on all windows consoles for now:
if (+process.env.NCURSES_UNICODE !== 0) {
ccp = 65001;
}
return ccp;
};