diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java index 67cf82cc1a0753..542c668459af51 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java @@ -40,6 +40,7 @@ import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; import java.util.Objects; public class StringLiteral extends LiteralExpr { @@ -310,7 +311,9 @@ public void setupParamFromBinary(ByteBuffer data, boolean isUnsigned) { } byte[] bytes = new byte[strLen]; data.get(bytes); - value = new String(bytes); + // ATTN: use fixed StandardCharsets.UTF_8 to avoid unexpected charset in + // different environment + value = new String(bytes, StandardCharsets.UTF_8); if (LOG.isDebugEnabled()) { LOG.debug("parsed value '{}'", value); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java index e608b68684b7a8..ba4fbfa1fcaed2 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java @@ -214,7 +214,9 @@ private static boolean isNull(byte[] bitmap, int position) { // process COM_EXECUTE, parse binary row data // https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_com_stmt_execute.html private void handleExecute() { - // debugPacket(); + if (LOG.isDebugEnabled()) { + debugPacket(); + } packetBuf = packetBuf.order(ByteOrder.LITTLE_ENDIAN); // parse stmt_id, flags, params int stmtId = packetBuf.getInt();