diff --git a/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/HttpHelper.java b/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/HttpHelper.java index d19db4c..f05f5a4 100644 --- a/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/HttpHelper.java +++ b/sgzb-common/sgzb-common-core/src/main/java/com/bonus/sgzb/common/core/utils/HttpHelper.java @@ -41,16 +41,16 @@ public class HttpHelper { System.out.println("JSONBody-=========:" + JSONBody); CloseableHttpClient httpClient = HttpClients.createDefault(); HttpPost httpPost = new HttpPost(url); - httpPost.addHeader("Content-Type", "application/json"); + httpPost.addHeader("Content-Type", "application/json; charset=UTF-8"); if (!CollectionUtils.isEmpty(headerMap)) { for (Map.Entry entry : headerMap.entrySet()) { httpPost.addHeader(entry.getKey(), entry.getValue()); } } - httpPost.setEntity(new StringEntity(JSONBody)); + httpPost.setEntity(new StringEntity(JSONBody,StandardCharsets.UTF_8)); CloseableHttpResponse response = httpClient.execute(httpPost); HttpEntity entity = response.getEntity(); - String responseContent = EntityUtils.toString(entity, "UTF-8"); + String responseContent = EntityUtils.toString(entity, StandardCharsets.UTF_8); response.close(); httpClient.close(); return responseContent;