alibaba / alibaba/DataX

数据库是latin1,即使设置了jdbcUrl的charsetEncoding,读取的数据仍为乱码

Open
#1,429 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
17.4k
Forks
5.7k
PR merge metrics
No merged PRs in 30d

Description

我的数据表是latin1编码的,mysqlreader的文档说会自动detect字符集,无需关心编码问题;
但是我拉回来的数据是utf8下的Latin1乱码(我在mysql client set names utf8后查询的结果和datax拉取的一样);
网上查了一堆说可以设置jdbcUrl的charsetEncoding来解决,并且mysqlreader的官方文档说支持原生mysql的jdbc配置,然而并没有生效;
我改成xxx:3306/db?charsetEncoding=Cp1252也没用,并且我尝试了各种字符集(GBK、Cp1252、UTF8),都无效果,并且神奇的是任意一种字符集的设置,拉回的乱码数据是一样的(正常来说,如果我设置了别的字符集,至少拉回来的数据是不同字符编码下的乱码才对,每次改charsetEncoding都是UTF8下的Latin1内容)
我深度怀疑datax并没有处理我jdbcUrl里的参数,仍按照UTF8给我拉取数据了

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how mysqlreader constructs and passes its JDBC URL, focusing on whether charsetEncoding is preserved. Reproduce the report with a latin1 MySQL table and several charsetEncoding values, then verify that the configured encoding is honored and the returned data is correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, mysql
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.