Skip to content

Commit 46a2715

Browse files
committed
默认编码问题
1 parent b7469c4 commit 46a2715

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

pay-java-common/src/main/java/com/egzosn/pay/common/http/ClientHttpRequest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,13 @@ public T handleResponse(HttpResponse response) throws ClientProtocolException, I
291291
private T toBean(HttpEntity entity, String[] contentType) throws IOException {
292292
//判断内容类型是否为文本类型
293293
if (isText(contentType[0])) {
294-
/* String charset = "UTF-8";
294+
/* String charset = "UTF-8";
295295
if (null != contentType && 2 == charset.length()) {
296296
charset = contentType[1].substring(contentType[1].indexOf("=") + 1);
297297
}*/
298+
298299
//获取响应的文本内容
299-
String result = EntityUtils.toString(entity, defaultCharset);
300+
String result = EntityUtils.toString(entity, getDefaultCharset());
300301
if (LOG.isDebugEnabled()){
301302
LOG.debug("请求响应内容:\r\n" + result);
302303
}
@@ -316,7 +317,7 @@ private T toBean(HttpEntity entity, String[] contentType) throws IOException {
316317
//xml类型
317318
if (isXml(contentType[0], first)) {
318319
try {
319-
return XML.toJSONObject(result, defaultCharset).toJavaObject(responseType);
320+
return XML.toJSONObject(result, getDefaultCharset()).toJavaObject(responseType);
320321
}catch (Exception e){
321322
;
322323
}

0 commit comments

Comments
 (0)