From cfb347cdb531cef56b796ed597a45d5643d2a3d2 Mon Sep 17 00:00:00 2001 From: shedfreewu Date: Thu, 8 May 2025 15:48:38 +0800 Subject: [PATCH] fix: fix chinese garbled characters in event. --- .../plugins/event/pushgateway/PushGatewayEventReporter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/polaris-plugins/polaris-plugins-observability/event-pushgateway/src/main/java/com/tencent/polaris/plugins/event/pushgateway/PushGatewayEventReporter.java b/polaris-plugins/polaris-plugins-observability/event-pushgateway/src/main/java/com/tencent/polaris/plugins/event/pushgateway/PushGatewayEventReporter.java index e744acb78..a510729b7 100644 --- a/polaris-plugins/polaris-plugins-observability/event-pushgateway/src/main/java/com/tencent/polaris/plugins/event/pushgateway/PushGatewayEventReporter.java +++ b/polaris-plugins/polaris-plugins-observability/event-pushgateway/src/main/java/com/tencent/polaris/plugins/event/pushgateway/PushGatewayEventReporter.java @@ -52,6 +52,7 @@ import java.net.URI; import java.net.URISyntaxException; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -223,7 +224,7 @@ private void postPushGatewayEvent(PushGatewayEventRequest request) { RequestConfig config = RequestConfig.custom().setConnectTimeout(2000).setConnectionRequestTimeout(10000).setSocketTimeout(10000).build(); try (CloseableHttpClient httpClient = HttpClientBuilder.create().setDefaultRequestConfig(config).build()) { HttpPost httpPost = new HttpPost(getEventUri()); - postBody = new StringEntity(mapper.writeValueAsString(request)); + postBody = new StringEntity(mapper.writeValueAsString(request), StandardCharsets.UTF_8); if (LOG.isDebugEnabled()) { LOG.debug("postPushGatewayEvent body:{}", postBody); }