Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.0k views
in Technique[技术] by (71.8m points)

axios 请求中文页面返回乱码的问题

let axios = require('axios')
let httpurl = "https://www.dytt8.net/index.htm"
axios.get(httpurl,{responseType:"gb2312"}).then(function(res){

 console.log(res)

})

请问该如何设置才能让返回的中文不是乱码呢?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

{responseType:"gb2312"}去掉。或者换成uft8


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...