看到星号问号了么,SuperAgent 爬取时中文乱码星号,只有中文是乱码,其它都是对的,肯定需要转义,找了两个小时,最后度娘看到个帖子
https://cloud.tencent.com/developer/article/1445392试了试,解决了
const request = require('superagent')require('superagent-charset')(request) request.get('http://tieba.baidu.com/').charset('gbk').end((err, res) => {console.log(res.text)})