Skip to content

Commit dded5cd

Browse files
authored
[fix](auditlog) fix AuditLoaderPlugin occasional occurrence garbled Chinese characters in audit logs (#61902)
1 parent 1063e20 commit dded5cd

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

fe/fe-core/src/main/java/org/apache/doris/qe/AuditLogHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public static String truncateByBytes(String str, int maxLen, String suffix) {
185185
}
186186
Charset utf8Charset = Charset.forName("UTF-8");
187187
CharsetDecoder decoder = utf8Charset.newDecoder();
188-
byte[] sb = str.getBytes();
188+
byte[] sb = str.getBytes(utf8Charset);
189189
ByteBuffer buffer = ByteBuffer.wrap(sb, 0, maxLen);
190190
CharBuffer charBuffer = CharBuffer.allocate(maxLen);
191191
decoder.onMalformedInput(CodingErrorAction.IGNORE);

fe_plugins/auditloader/src/main/java/org/apache/doris/plugin/audit/custom/AuditLoaderPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ private String truncateByBytes(String str) {
199199
}
200200
Charset utf8Charset = Charset.forName("UTF-8");
201201
CharsetDecoder decoder = utf8Charset.newDecoder();
202-
byte[] sb = str.getBytes();
202+
byte[] sb = str.getBytes(utf8Charset);
203203
ByteBuffer buffer = ByteBuffer.wrap(sb, 0, maxLen);
204204
CharBuffer charBuffer = CharBuffer.allocate(maxLen);
205205
decoder.onMalformedInput(CodingErrorAction.IGNORE);

0 commit comments

Comments
 (0)