解决前端获取后端gbk文件导致中文乱码的问题
let url = 'xxx' axios .get(url, { responseType: 'blob', }) .then(res => { let reader = new FileReader() reader.readAsText(res, 'GBK') reader.onload = e => { let data = JSON.parse(reader.result) console.log(data) } }) .catch(e => { console.log(e) })
参考地址:https://www.cnblogs.com/bjhl/articles/10514038.html