fix charset to utf-8

This commit is contained in:
hffariel 2021-09-15 19:58:29 +08:00
parent 39c7065526
commit 9e9fd10b44
2 changed files with 3 additions and 2 deletions

View File

@ -168,7 +168,7 @@ public class StarRocksStreamLoadVisitor {
private String getBasicAuthHeader(String username, String password) {
String auth = username + ":" + password;
byte[] encodedAuth = Base64.encodeBase64(auth.getBytes());
byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.UTF_8));
return new StringBuilder("Basic ").append(new String(encodedAuth)).toString();
}

View File

@ -4,6 +4,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@ -38,7 +39,7 @@ public class StarRocksWriterManager {
try {
buffer.add(record);
batchCount++;
batchSize += record.getBytes().length;
batchSize += record.getBytes(StandardCharsets.UTF_8).length;
if (batchCount >= writerOptions.getBatchRows() || batchSize >= writerOptions.getBatchSize()) {
String label = createBatchLabel();
LOG.debug(String.format("StarRocks buffer Sinking triggered: rows[%d] label[%s].", batchCount, label));