From cf6e7e7df6f2512a7aaf43bf5b25c26db11098d4 Mon Sep 17 00:00:00 2001 From: egzosn Date: Wed, 20 Dec 2017 17:50:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=B7=E6=B1=82=E5=B7=A5=E5=85=B7=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E7=B1=BB=E5=9E=8B=E7=BC=96=E7=A0=81UTF-8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/egzosn/pay/common/http/ClientHttpRequest.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pay-java-common/src/main/java/com/egzosn/pay/common/http/ClientHttpRequest.java b/pay-java-common/src/main/java/com/egzosn/pay/common/http/ClientHttpRequest.java index ccfdb8a..5cdec5e 100644 --- a/pay-java-common/src/main/java/com/egzosn/pay/common/http/ClientHttpRequest.java +++ b/pay-java-common/src/main/java/com/egzosn/pay/common/http/ClientHttpRequest.java @@ -32,6 +32,10 @@ import static com.egzosn.pay.common.http.UriVariables.getMapToParameters; * */ public class ClientHttpRequest extends HttpEntityEnclosingRequestBase implements org.apache.http.client.ResponseHandler{ + + public static final ContentType APPLICATION_FORM_URLENCODED_UTF_8 = ContentType.create("application/x-www-form-urlencoded", Consts.UTF_8);; + + /** * http请求方式 get pos */ @@ -151,13 +155,13 @@ public class ClientHttpRequest extends HttpEntityEnclosingRequestBase impleme return this; } if (request instanceof Map) { - StringEntity entity = new StringEntity(getMapToParameters((Map) request), ContentType.APPLICATION_FORM_URLENCODED); + StringEntity entity = new StringEntity(getMapToParameters((Map) request), APPLICATION_FORM_URLENCODED_UTF_8); setEntity(entity); } else if (request instanceof String) { - StringEntity entity = new StringEntity((String) request, ContentType.APPLICATION_FORM_URLENCODED); + StringEntity entity = new StringEntity((String) request, APPLICATION_FORM_URLENCODED_UTF_8); setEntity(entity); } else { - StringEntity entity = new StringEntity(JSON.toJSONString(request), ContentType.APPLICATION_JSON); + StringEntity entity = new StringEntity(JSON.toJSONString(request), APPLICATION_FORM_URLENCODED_UTF_8); setEntity(entity); }