buffer 转 string 显示的时候乱码,操作系统是windows,代码如下:
var buf = new Buffer("test测试","utf8");
console.log(buf);
console.log(buf.length);
console.log(buf.toString("utf8"));
输出: E:\test\nodejstest>node test.js <Buffer 74 65 73 74 ef bf bd ef bf bd ef bf bd ef bf bd> 16 test����