wechatpay-apiv3 / wechatpay-apache-httpclient

微信支付 APIv3 Apache HttpClient装饰器(decorator)
https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/index.shtml
Apache License 2.0
674 stars 251 forks source link

签名参数乱码问题 #8

Closed rheff closed 4 years ago

rheff commented 4 years ago

本地实测时发现WechatPay2Credentials.java中方法buildMessage(String nonce, long timestamp, HttpUriRequest request)在签名处理的时候会产生中文乱码问题 将EntityUtils.toString(xxx) 修改成EntityUtils.toString(xxx,“utf-8”)解决该问题。

xy-peng commented 4 years ago

你应该在调用httpclient之前,xxxEntity构造时,指定了对应的字符编码

你可以参考下这个testcase,https://github.com/wechatpay-apiv3/wechatpay-apache-httpclient/commit/88f8d5b35e1e047e33d46ad23a479e6f43c6dc20