thswlsqls opened a new issue, #39139:
URL: https://github.com/apache/shardingsphere/issues/39139
## Bug Report
### Which version of ShardingSphere did you use?
master @ 7568693 (5.5.4-SNAPSHOT)
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
N/A (protocol layer, used by data pipeline / CDC binlog ingestion)
### Expected behavior
MySQL JSON columns are stored as utf8mb4. When a JSON binlog value is
decoded, non-ASCII characters in string values and object keys should be
preserved (for example `{"名前":"café"}`).
### Actual behavior
`MySQLJsonValueDecoder` reconstructs decoded bytes with `new
String(byte[])`, which uses the JVM default charset. On any JVM whose default
charset is not UTF-8, non-ASCII JSON string values and keys become mojibake or
replacement characters.
### Reason analyze (If you can)
`MySQLJsonValueDecoder.decodeString()` (line 216) and `decodeKeyEntry()`
(line 145) call `new String(bytes)` without a charset. The class Javadoc
documents the STRING type as `Utf8mb4 string`, and the module reader
`MySQLPacketPayload` always decodes with an explicit charset. Both sites should
use `StandardCharsets.UTF_8`.
### Steps to reproduce the behavior
Decode a MySQL JSON binlog value containing a multibyte UTF-8 string or key
on a JVM started with a non-UTF-8 default charset
(`-Dfile.encoding=ISO-8859-1`); the decoded JSON text differs from the source.
### Example codes for reproduce this issue (such as a github link).
N/A
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]