There are currently billions of users in China using windows OS.
Unfortunately their terminal (& some files) doesn't support UTF-8 encoding, instead some shitty standard called "GBK".
Thus adding GBK encoding is highly recommended for file-reading and child_process.exec 's output.
Example:

You can already do this using TextDecoder, which is available in node as util.TextDecoder. You will need either full ICU compiled into your node binary or the full-icu package installed from npm.
If that isn't your thing, there are other text conversion modules on npm such as iconv-lite and iconv.
iconv-lite doesn’t handle the exec error well
And iconv doesn’t support win32 ?
And iconv doesn’t support win32 ?
It does. (I'm its author.)
Sorry. I have some other dependencies warning right after the installation error, and cause the confusion.


You need to use python 2, node-gyp (the build tool) isn't compatible with python 3.
I'll take the liberty of closing this out because the original question has been answered.
“Who’s using python3? Only python 2 is my jam”
“Who’s using node current version? I’m using Node V6, that’s the mainstream”
“Only real & hardcore programmers use MIPS, C is definitely a cult”
“Why not let those Chinese bastards all suffer from bad encoding, and let them spend hours to find compromisable solutions ?”
“Hey, if you have so many complains, use PHP”
Sorry but not sorry.
@Truth1984 If you want to see Python 3 support in node-gyp, there is https://github.com/nodejs/node-gyp/issues/1337 which you might consider helping out.
If you want full-ICU in Node.js by default and switch to TextDecoder for GBK handling, you may consider helping out with https://github.com/nodejs/node/issues/19214
This is open source. Words do not make things happen, contribution does.
Oh boi, yes they do.
I don’t give a shit about GBK
I can read English and turn OS into English as well.
Then I don’t need to deal with this shitty standard problem any more.
Besides, I do have some knowledge to write proper bash/script, and prevent errors.
Then let me ask you, if not for me, who am I doing this for? Huh?
Then let me ask you, if not for me, who am I doing this for? Huh?
Exactly.