在nodejs中显示正常中文输出 1. [代码] 中文显示 var fileStr = fs.readFileSync(filePath, {encoding:'binary'});var buf = new Buffer(fileStr, 'binary');var str = iconv.decode(buf, 'GBK');console.log(str);//正常显示
1. [代码]中文显示
var fileStr = fs.readFileSync(filePath, {encoding:'binary'}); var buf = new Buffer(fileStr, 'binary'); var str = iconv.decode(buf, 'GBK'); console.log(str);//正常显示