我向Request-Promise发出了一个请求,请求后带有变音:
var file = rp({uri: serviceURL, encoding: 'utf8'}).forEach(function (polizeistelle) {
console.log(polizeistelle)
}在控制台日志中显示'pr�si‘而不是'präsi’
感谢你的帮助
发布于 2017-03-05 21:54:48
这是因为serviceURL没有提供utf8。在这里,utf-8没有转换为utf8,而只是告诉将响应解释为utf8。
你应该使用
rp({uri: serviceURL, encoding: 'latin1'})正确读取响应,并在需要时将其转换为utf8。
https://stackoverflow.com/questions/42609040
复制相似问题