【发布时间】:2019-04-03 05:31:29
【问题描述】:
我在我的 nodejs express 应用程序中使用请求模块,我需要在查询字符串中传递任何重音字符(例如:josé),但是当其他客户端收到请求时,它会得到一个未知字符(?)。
如果我通过浏览器或邮递员传递相同的 url,客户端会得到正确的重音字符。
var request = require('request-promise');
var url = 'http://mypathtotheurl?var=josé';
const optionsStart = {
url: url,
method: "GET",
encoding: "binary",
headers: {
"Content-type": "applcation/pdf"
}
};
request(optionsStart).then(function(body, data) {
//my logic working as expected except for show special chars
}
通过浏览器或邮递员得到正确的响应,通过请求模块得到未知字符
【问题讨论】:
标签: node.js url request query-string