Skip to content

Commit bf2b4ee

Browse files
committed
字符编码字符串用常量替换
1 parent 6847a41 commit bf2b4ee

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ public byte[] createScanPayQrcodeMode1(String productId, File logoFile, Integer
385385
String content = createScanPayQrcodeMode1(productId);
386386
return createQrcode(content, logoFile, sideLength);
387387
}
388-
388+
389389
@Override
390390
public String createScanPayQrcodeMode1(String productId){
391391
//weixin://wxpay/bizpayurl?sign=XXXXX&appid=XXXXX&mch_id=XXXXX&product_id=XXXXXX&time_stamp=XXXXXX&nonce_str=XXXXX
@@ -400,7 +400,7 @@ public String createScanPayQrcodeMode1(String productId){
400400
String sign = this.createSign(params);
401401
params.put("sign", sign);
402402

403-
403+
404404
for (String key : params.keySet()) {
405405
codeUrl.append(key + "=" + params.get(key) + "&");
406406
}
@@ -414,7 +414,7 @@ public String createScanPayQrcodeMode1(String productId){
414414
public byte[] createScanPayQrcodeMode2(String codeUrl, File logoFile, Integer sideLength) {
415415
return createQrcode(codeUrl, logoFile, sideLength);
416416
}
417-
417+
418418
private byte[] createQrcode(String content, File logoFile, Integer sideLength) {
419419
if (sideLength == null || sideLength < 1) {
420420
return QrcodeUtils.createQrcode(content, logoFile);
@@ -491,7 +491,7 @@ private String postWithKey(String url, String requestStr) throws WxErrorExceptio
491491
HttpPost httpPost = new HttpPost(url);
492492

493493
try (CloseableHttpClient httpclient = HttpClients.custom().setSSLSocketFactory(sslsf).build()) {
494-
httpPost.setEntity(new StringEntity(new String(requestStr.getBytes("UTF-8"), "ISO-8859-1")));
494+
httpPost.setEntity(new StringEntity(new String(requestStr.getBytes(CharEncoding.UTF_8), CharEncoding.ISO_8859_1)));
495495
try (CloseableHttpResponse response = httpclient.execute(httpPost)) {
496496
String result = EntityUtils.toString(response.getEntity(), Consts.UTF_8);
497497
this.log.debug("\n[URL]: {}\n[PARAMS]: {}\n[RESPONSE]: {}", url, requestStr, result);

0 commit comments

Comments
 (0)