DBZ-4983 Use correct Java encoding Charset in AbstractMysqlFieldReader
This commit is contained in:
parent
b7eab5f160
commit
fec5aef1ec
@ -28,6 +28,7 @@ public abstract class AbstractMysqlFieldReader implements MysqlFieldReader {
|
|||||||
protected final Logger logger = LoggerFactory.getLogger(getClass());
|
protected final Logger logger = LoggerFactory.getLogger(getClass());
|
||||||
|
|
||||||
private static final Set<String> TEXT_DATATYPES = Collect.unmodifiableSet("CHAR", "VARCHAR", "TEXT");
|
private static final Set<String> TEXT_DATATYPES = Collect.unmodifiableSet("CHAR", "VARCHAR", "TEXT");
|
||||||
|
private static final MySqlValueConverters.CharsetMappingWrapper CHARSET_MAPPING_WRAPPER = new MySqlValueConverters.CharsetMappingWrapper();
|
||||||
|
|
||||||
private final MySqlConnectorConfig connectorConfig;
|
private final MySqlConnectorConfig connectorConfig;
|
||||||
|
|
||||||
@ -71,7 +72,7 @@ public Object readField(ResultSet rs, int columnIndex, Column column, Table tabl
|
|||||||
try {
|
try {
|
||||||
String columnData = rs.getString(columnIndex);
|
String columnData = rs.getString(columnIndex);
|
||||||
if (columnData != null) {
|
if (columnData != null) {
|
||||||
return columnData.getBytes(column.charsetName());
|
return columnData.getBytes(CHARSET_MAPPING_WRAPPER.getJavaEncodingForMysqlCharSet(column.charsetName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (UnsupportedEncodingException e) {
|
catch (UnsupportedEncodingException e) {
|
||||||
|
@ -77,7 +77,7 @@ public static interface ParsingErrorHandler {
|
|||||||
/**
|
/**
|
||||||
* Helper to gain access to protected method
|
* Helper to gain access to protected method
|
||||||
*/
|
*/
|
||||||
private final static class CharsetMappingWrapper extends CharsetMapping {
|
public final static class CharsetMappingWrapper extends CharsetMapping {
|
||||||
String getJavaEncodingForMysqlCharSet(String mySqlCharsetName) {
|
String getJavaEncodingForMysqlCharSet(String mySqlCharsetName) {
|
||||||
return CharsetMapping.getStaticJavaEncodingForMysqlCharset(mySqlCharsetName);
|
return CharsetMapping.getStaticJavaEncodingForMysqlCharset(mySqlCharsetName);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user