diff --git a/src/main/java/net/snowflake/client/core/json/BytesConverter.java b/src/main/java/net/snowflake/client/core/json/BytesConverter.java index 1600da0b9..eb1f80a5a 100644 --- a/src/main/java/net/snowflake/client/core/json/BytesConverter.java +++ b/src/main/java/net/snowflake/client/core/json/BytesConverter.java @@ -1,7 +1,6 @@ package net.snowflake.client.core.json; import java.nio.ByteBuffer; -import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.sql.Types; import net.snowflake.client.core.SFException; @@ -54,7 +53,7 @@ public byte[] getBytes(Object obj, int columnType, int columnSubType, Integer sc return converters .getStringConverter() .getString(obj, columnType, columnSubType, scale) - .getBytes(); + .getBytes(StandardCharsets.UTF_8); case Types.BOOLEAN: return converters.getBooleanConverter().getBoolean(obj, columnType) ? new byte[] {1} diff --git a/src/test/java/net/snowflake/client/jdbc/structuredtypes/StructuredTypesGetStringBaseIT.java b/src/test/java/net/snowflake/client/jdbc/structuredtypes/StructuredTypesGetStringBaseIT.java index c8d18a051..392afd84b 100644 --- a/src/test/java/net/snowflake/client/jdbc/structuredtypes/StructuredTypesGetStringBaseIT.java +++ b/src/test/java/net/snowflake/client/jdbc/structuredtypes/StructuredTypesGetStringBaseIT.java @@ -1,9 +1,7 @@ package net.snowflake.client.jdbc.structuredtypes; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.sql.Connection; import java.sql.ResultSet; @@ -69,9 +67,8 @@ protected void assertGetObjectIsCompatible(ResultSet resultSet, String expected) protected void assertGetBytesIsCompatible(ResultSet resultSet, String expected) throws SQLException { - assertEquals(StandardCharsets.UTF_8, Charset.defaultCharset()); TestUtil.assertEqualsIgnoringWhitespace( - expected, new String(resultSet.getBytes(1))); + expected, new String(resultSet.getBytes(1), StandardCharsets.UTF_8)); } protected void withFirstRow(