From 58c93f249924f5c666a1f66aad416ce3a7f12565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=96=87=E5=90=9B?= <17366018883@163.com> Date: Thu, 10 Aug 2023 17:35:22 +0800 Subject: [PATCH] Fix Chinese garbled code issue when HTTP post input parameter is param --- .../org/apache/linkis/httpclient/AbstractHttpClient.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/AbstractHttpClient.scala b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/AbstractHttpClient.scala index 7b443eb920..9007d6d32b 100644 --- a/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/AbstractHttpClient.scala +++ b/linkis-commons/linkis-httpclient/src/main/scala/org/apache/linkis/httpclient/AbstractHttpClient.scala @@ -285,7 +285,7 @@ abstract class AbstractHttpClient(clientConfig: ClientConfig, clientName: String if (v != null) nameValuePairs.add(new BasicNameValuePair(k, v.toString)) } } - httpPut.setEntity(new UrlEncodedFormEntity(nameValuePairs)) + httpPut.setEntity(new UrlEncodedFormEntity(nameValuePairs, Charset.defaultCharset)) } if (StringUtils.isNotBlank(put.getRequestPayload)) { @@ -343,7 +343,7 @@ abstract class AbstractHttpClient(clientConfig: ClientConfig, clientName: String post.getParameters.asScala.foreach { case (k, v) => if (v != null) nvps.add(new BasicNameValuePair(k, v.toString)) } - httpPost.setEntity(new UrlEncodedFormEntity(nvps)) + httpPost.setEntity(new UrlEncodedFormEntity(nvps, Charset.defaultCharset)) } else if (post.getFormParams.asScala.nonEmpty) { post.getFormParams.asScala.foreach { case (k, v) => if (v != null) nvps.add(new BasicNameValuePair(k, v.toString))