Skip to content

Commit

Permalink
add charset specification
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-mkubik committed Nov 20, 2024
1 parent 67e001b commit f851245
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit f851245

Please sign in to comment.