Closed delubee closed 2 years ago
I have just started to try JDBC bridge, and we also have an abnormal problem in Chinese fields. Do you have a repair plan?
I have just started to try JDBC bridge, and we also have an abnormal problem in Chinese fields. Do you have a repair plan?
I'll take a look tonight to see if this can be quickly fixed.
The question arises here:: https://github.com/ClickHouse/clickhouse-jdbc-bridge/blob/f02b015093a3ef6b159c8ebd5fec1ceca98e0e87/src/main/java/ru/yandex/clickhouse/jdbcbridge/core/DataTableReader.java#L105-L116 due to: ColumnDefinition[] requestColumn != ColumnDefinition[] resultColumns Because the following code cannot parse Chinese: https://github.com/ClickHouse/clickhouse-jdbc-bridge/blob/f02b015093a3ef6b159c8ebd5fec1ceca98e0e87/src/main/java/ru/yandex/clickhouse/jdbcbridge/core/QueryParser.java#L317-L331 I think it can be changed to: URLDecoder.decode(str, "utf-8");
Thanks @yingyingqiqi for investigating the issue. Actually above code has nothing to do with charset encoding because it's based on characters. However, there is issue extracting query parameters but I haven't checked if it's caused by Vertx or ClickHouse.
The question arises here::
due to: ColumnDefinition[] requestColumn != ColumnDefinition[] resultColumns Because the following code cannot parse Chinese: https://github.com/ClickHouse/clickhouse-jdbc-bridge/blob/f02b015093a3ef6b159c8ebd5fec1ceca98e0e87/src/main/java/ru/yandex/clickhouse/jdbcbridge/core/QueryParser.java#L317-L331
I think it can be changed to: URLDecoder.decode(str, "utf-8");
it works :
// columns = unescape(table.substring(len, index)); // table = unescape(table.substring(index + 1)); try { columns = URLDecoder.decode(table.substring(len, index), "utf-8"); table = URLDecoder.decode(table.substring(index + 1), "utf-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); }
it works
Good work. Mind to submit a pull request?
when the column name is Chinese I got this error:
table t2 DDL : create table t2 ( id int not null, 字段1 varchar(255) )
and when the table name is Chinese I got this error:
table 表1 DDL: create table 表1 ( id int not null, f1 varchar(255) )
and when column and table names is ASCII , it’s fine.