mirror of
https://gitee.com/egzosn/pay-java-parent.git
synced 2026-05-07 19:46:15 +08:00
同步回调乱码问题
This commit is contained in:
@@ -17,6 +17,7 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -243,6 +244,17 @@ public class AliPayService extends BasePayService {
|
||||
for (int i = 0,len = values.length; i < len; i++) {
|
||||
valueStr += (i == len - 1) ? values[i] : values[i] + ",";
|
||||
}
|
||||
//乱码解决,这段代码在出现乱码时使用。如果mysign和sign不相等也可以使用这段代码转化
|
||||
//valueStr = new String(valueStr.getBytes("ISO-8859-1"), "gbk");
|
||||
if (!valueStr.matches("\\w+")){
|
||||
try {
|
||||
if(valueStr.equals(new String(valueStr.getBytes("iso8859-1"), "iso8859-1"))){
|
||||
valueStr=new String(valueStr.getBytes("iso8859-1"), payConfigStorage.getInputCharset());
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
params.put(name, valueStr);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user