Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down