在sublime text3安装完nodejs的插件后,运行console.log("你好"),发现控制台出现中文乱码,解决办法:Preferences-> Browser Packages 打开文件夹后找到 Nodejs -> Nodejs.sublime-build
改其中的encoding为utf-8即可, 默认为cp1252
1 { 2 ??"cmd": ["node", "$file"], 3 ??"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", 4 ??"selector": "source.js", 5 ??"shell": true, 6 ??"encoding": "utf-8", 7 ??"windows": 8 ????{ 9 ????????"shell_cmd": "taskkill /F /IM node.exe & node $file"10 ????},11 ????"linux":12 ????{13 ????????"shell_cmd": "killall node; /usr/bin/env node $file"14 ????},15 ????"osx":16 ????{17 ????????"shell_cmd": "killall node; /usr/bin/env node $file"18 ????}19 }
sublime text3 nodejs控制台输出结果中文乱码
原文地址:https://www.cnblogs.com/clicklin/p/9291653.html