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

nodejs gb2312编码转换成ubtf8乱码,请问是为什么?

$
0
0

贴代码: var request = require(‘superagent’); var iconv = require(‘iconv-lite’); var url = “http://opinion.people.com.cn/n1/2016/1116/c1003-28873412.html”; request .get(url) .end(function(err, res){ var text = iconv.decode(new Buffer(res.text), ‘GB2312’) console.log(text) });

网页编码是gb2312的,不知道为什么输出的网页经过转码后,字符全是锟斤拷台锟斤拷锟斤拷应锟斤拷台锟斤拷锟斤拷锟节碉拷锟叫癸拷锟斤拷锟斤拷锟斤拷锟斤拷同锟


Viewing all articles
Browse latest Browse all 14821

Trending Articles