我正在通过 nodejs sdk 从 Node 应用程序中请求:
paypal.payment.create({ ... }, function (err, transaction) {
fn(err, transaction);
});
shipping_address
负载如下所示:
{
recipient_name : 'Max Mustermann',
line1 : 'Neue Schönhauser Str 18', // the 'ö' causes error
line2 : 'Vorderhaus, links',
city : 'Berlin',
country_code : 'DE',
postal_code : '10178',
state : 'BE',
type : 'residential'
}
line1
键值中的 utf-8 字符导致 MALFORMED_REQUEST
错误。如果我用 oe
替换它,一切正常。
paypal 的 REST api 是否理解 utf-8?
我必须在某处设置字符编码吗?
谢谢
最佳答案
问题是由于从 nodejs sdk 而不是 API 设置了不正确的 Content-Length。我们已修复 SDK 并将最新版本发布到 npm。请使用具有相同修复程序的 0.6.4 版本。感谢您的报告。
关于node.js - Paypal REST API : shipping_address does not understand utf8 characters,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18416504/