From b220383758021bcb26d0a788ebe9a31795d23b6d Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期五, 26 四月 2024 09:41:57 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java
index 3f990a0..c3c5cdb 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java
@@ -18,6 +18,8 @@
 import org.springframework.web.context.request.ServletRequestAttributes;
 
 import java.io.*;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -164,7 +166,7 @@
             if (inputStream == null) {
                 throw new HttpRequestException(RESPONSE_NULL_ERROR_CODE, "鍝嶅簲涓簄ull");
             }
-            BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
+            BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("GB2312")));
             StringBuffer stringBuffer = new StringBuffer();
             String str = "";
             while ((str = reader.readLine()) != null) {
@@ -186,7 +188,7 @@
                         RESPBODY respBody = JSON.parseObject(respStr, respBodyClass);
                         rep = new HttpEntity<RESPBODY>(respHeaders, respBody);
                     } else {
-                        rep = new HttpEntity<RESPBODY>(respHeaders, (RESPBODY) respStr);
+                        rep = new HttpEntity<RESPBODY>(respHeaders, (RESPBODY) new String(respStr.getBytes("ISO8859-1"), StandardCharsets.UTF_8));
                     }
                 }
                 return rep;

--
Gitblit v1.9.3