From bf2b4eed55a7ba472f7de1070b3b2578a52ee145 Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Tue, 21 Mar 2017 18:01:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=97=E7=AC=A6=E7=BC=96=E7=A0=81=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2=E7=94=A8=E5=B8=B8=E9=87=8F=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../binarywang/wxpay/service/impl/WxPayServiceImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceImpl.java index b480a5f3..6e0cb148 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceImpl.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceImpl.java @@ -385,7 +385,7 @@ public class WxPayServiceImpl implements WxPayService { String content = createScanPayQrcodeMode1(productId); return createQrcode(content, logoFile, sideLength); } - + @Override public String createScanPayQrcodeMode1(String productId){ //weixin://wxpay/bizpayurl?sign=XXXXX&appid=XXXXX&mch_id=XXXXX&product_id=XXXXXX&time_stamp=XXXXXX&nonce_str=XXXXX @@ -400,7 +400,7 @@ public class WxPayServiceImpl implements WxPayService { String sign = this.createSign(params); params.put("sign", sign); - + for (String key : params.keySet()) { codeUrl.append(key + "=" + params.get(key) + "&"); } @@ -414,7 +414,7 @@ public class WxPayServiceImpl implements WxPayService { public byte[] createScanPayQrcodeMode2(String codeUrl, File logoFile, Integer sideLength) { return createQrcode(codeUrl, logoFile, sideLength); } - + private byte[] createQrcode(String content, File logoFile, Integer sideLength) { if (sideLength == null || sideLength < 1) { return QrcodeUtils.createQrcode(content, logoFile); @@ -491,7 +491,7 @@ public class WxPayServiceImpl implements WxPayService { HttpPost httpPost = new HttpPost(url); try (CloseableHttpClient httpclient = HttpClients.custom().setSSLSocketFactory(sslsf).build()) { - httpPost.setEntity(new StringEntity(new String(requestStr.getBytes("UTF-8"), "ISO-8859-1"))); + httpPost.setEntity(new StringEntity(new String(requestStr.getBytes(CharEncoding.UTF_8), CharEncoding.ISO_8859_1))); try (CloseableHttpResponse response = httpclient.execute(httpPost)) { String result = EntityUtils.toString(response.getEntity(), Consts.UTF_8); this.log.debug("\n[URL]: {}\n[PARAMS]: {}\n[RESPONSE]: {}", url, requestStr, result);