diff --git a/src/main/java/net/snowflake/client/core/arrow/ArrayConverter.java b/src/main/java/net/snowflake/client/core/arrow/ArrayConverter.java index 6f18d06d2..e62e68277 100644 --- a/src/main/java/net/snowflake/client/core/arrow/ArrayConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/ArrayConverter.java @@ -31,7 +31,7 @@ public Object toObject(int index) throws SFException { @Override public byte[] toBytes(int index) throws SFException { - return isNull(index) ? null : toString(index).getBytes(StandardCharsets.UTF_8); + return isNull(index) ? null : toString(index).getBytes(); } @Override diff --git a/src/main/java/net/snowflake/client/core/arrow/MapConverter.java b/src/main/java/net/snowflake/client/core/arrow/MapConverter.java index 0c6ca072e..8b77e06b4 100644 --- a/src/main/java/net/snowflake/client/core/arrow/MapConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/MapConverter.java @@ -46,7 +46,7 @@ public Object toObject(int index) throws SFException { @Override public byte[] toBytes(int index) throws SFException { - return isNull(index) ? null : toString(index).getBytes(StandardCharsets.UTF_8); + return isNull(index) ? null : toString(index).getBytes(); } @Override diff --git a/src/main/java/net/snowflake/client/core/arrow/StructConverter.java b/src/main/java/net/snowflake/client/core/arrow/StructConverter.java index 2e5c2e38d..2e26f4e85 100644 --- a/src/main/java/net/snowflake/client/core/arrow/StructConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/StructConverter.java @@ -29,7 +29,7 @@ public Object toObject(int index) throws SFException { @Override public byte[] toBytes(int index) throws SFException { - return isNull(index) ? null : toString(index).getBytes(StandardCharsets.UTF_8); + return isNull(index) ? null : toString(index).getBytes(); } @Override diff --git a/src/main/java/net/snowflake/client/core/arrow/VectorTypeConverter.java b/src/main/java/net/snowflake/client/core/arrow/VectorTypeConverter.java index af65e8ae6..8c25c311c 100644 --- a/src/main/java/net/snowflake/client/core/arrow/VectorTypeConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/VectorTypeConverter.java @@ -34,7 +34,7 @@ public Object toObject(int index) throws SFException { @Override public byte[] toBytes(int index) throws SFException { - return isNull(index) ? null : toString(index).getBytes(StandardCharsets.UTF_8); + return isNull(index) ? null : toString(index).getBytes(); } @Override 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 eb1f80a5a..1f1423dec 100644 --- a/src/main/java/net/snowflake/client/core/json/BytesConverter.java +++ b/src/main/java/net/snowflake/client/core/json/BytesConverter.java @@ -53,7 +53,7 @@ public byte[] getBytes(Object obj, int columnType, int columnSubType, Integer sc return converters .getStringConverter() .getString(obj, columnType, columnSubType, scale) - .getBytes(StandardCharsets.UTF_8); + .getBytes(); 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 392afd84b..ccd6fdb31 100644 --- a/src/test/java/net/snowflake/client/jdbc/structuredtypes/StructuredTypesGetStringBaseIT.java +++ b/src/test/java/net/snowflake/client/jdbc/structuredtypes/StructuredTypesGetStringBaseIT.java @@ -2,7 +2,7 @@ import static org.junit.Assert.assertTrue; -import java.nio.charset.StandardCharsets; +import java.nio.charset.Charset; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; @@ -68,7 +68,7 @@ protected void assertGetObjectIsCompatible(ResultSet resultSet, String expected) protected void assertGetBytesIsCompatible(ResultSet resultSet, String expected) throws SQLException { TestUtil.assertEqualsIgnoringWhitespace( - expected, new String(resultSet.getBytes(1), StandardCharsets.UTF_8)); + expected, new String(resultSet.getBytes(1), Charset.defaultCharset())); } protected void withFirstRow(