mycli
mycli copied to clipboard
Using mycli sometimes Chinese gibber
Only some tables are garbled, and the character set has been set to utf8mb4
Me,too. All tables can work well in mysql
, but part of them behave strange in mycli
.
My running env is mysql Ver 14.14 Distrib 5.7.17, for Win64 (x86_64)
and mycli Version: 1.19.0
Some tests have been made as follows:
- if I create a table and insert data by
create table student(
sno int,
sname varchar(6),
ssex varchar(1),
sage int unsigned,
sdept varchar(15)
) character set = utf8mb4;
insert into student values(15001, '张三2', '男', 20, 'CS');
select * from student;
the output is gibber
+-------+-------+------+------+-------+ | sno | sname | ssex | sage | sdept | +-------+-------+------+------+-------+ | 15001 | 寮犱笁2 | 鐢? | 20 | CS | +-------+-------+------+------+-------+
but if I just remove first column, the problem should disappear...
create table student(
sname varchar(6),
ssex varchar(1),
sage int unsigned,
sdept varchar(15)
) character set = utf8mb4;
insert into student values( '张三', '男', 20, 'CS');
select * from student;
new output is correct
+-------+------+------+-------+ | sname | ssex | sage | sdept | +-------+------+------+-------+ | 张三 | 男 | 20 | CS | +-------+------+------+-------+
Besides, I tried many other aproaches to solve, e.g, switch all character set to utf8 or utf8mb4, but they don't work.
If you are win10, you can try this: https://github.com/dbcli/mycli/issues/877#issuecomment-665533179 即“控制面板” -> "时钟和区域" -> “管理” -> 系统区域设置为中文之后,勾选“Beta版:使用 Unicode UTF-8 提供全球语言支持(U)”,重启电脑即可。