Quantcast
Channel: CNode:Node.js专业中文社区
Viewing all articles
Browse latest Browse all 14821

新人求教:buffer转string中文乱码

$
0
0

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����


Viewing all articles
Browse latest Browse all 14821

Trending Articles