这可能是由于Ubuntu和Windows的默认编码设置不同造成的。在Ubuntu中,可以尝试在Axios请求中指定响应格式为'utf8',例如:
axios.get('http://example.com')
.then(response => {
console.log(response.data.toString('utf8'));
})
.catch(error => {
console.log(error);
});
这里的.toString('utf8')
可以将响应数据转换为可读格式。在Windows中可能不需要这个转换。可以尝试在Ubuntu中使用该方法来解决问题。