From a42631cbc775c4bfffe635fdf835f8e780036ccb Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Mon, 27 Apr 2015 00:19:55 -0700 Subject: [PATCH] fix unicode on windows. see #130. --- lib/tput.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/tput.js b/lib/tput.js index 9d01c91..3a81de4 100644 --- a/lib/tput.js +++ b/lib/tput.js @@ -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; };