Chinese Garbled

[expired user #7812]'s profile image [expired user #7812] posted 10 years ago in General Permalink
hi, i have some question. mysql server version is 5.1.54, database character set use "latin1", field's text encoding is 'gbk', i use heidisql connect to server, then show how Chinese Garbled, how can i setting in heidisql that it show normal?
Thank you a lot.

if i set text encoding is 'gbk' in connect setting, it show Chinese normal in a similar tool(call "Navicat for MySQL")
ansgar's profile image ansgar posted 10 years ago Permalink
HeidiSQL strictly uses UTF-8 for communicating with servers. There is no option in the connection to change that. If it's garbled, then we probably need UTF-16 here, or? I guess not all Chinese chars fit into the UTF-8 charset, do they?
[expired user #7812]'s profile image [expired user #7812] posted 10 years ago Permalink
If I query a data, MySQL Server return results, and i find results's text encoding is 'utf8' in HeidiSQL. I mean whether to show results with a specific code, Such as 'gbk'.
ansgar's profile image ansgar posted 10 years ago Permalink
UTf-8 should contain all characters present in gbk. Same with other encodings like latin1. They're all displayed fine with utf-8 in heidisql. I'm just not sure if we probably need utf-16 for gbk displaying.
ansgar's profile image ansgar posted 10 years ago Permalink
As what Wikipedia says, GBK is displayable in UTF-8. So, I guess your data is stored in a different charset than your fields say.

Watch out for the charset of your table and - if different - the charset of your fields. Post that here please.
ansgar's profile image ansgar posted 10 years ago Permalink
You can simply go to Heidi's "Table" tab, then click "Create code", and copy the contents from there and paste them here.
kalvaro's profile image kalvaro posted 10 years ago Permalink
The UTF-8 support in MySQL has its quirks (as in most other platforms and languages) but it should be able to hold Chinese characters just fine. Only exotic chars in the highest planes like
kalvaro's profile image kalvaro posted 10 years ago Permalink
*********!!!!

The forum has stripped out 95% of my post! Everything after an attempt to print a high-plane Unicode character!!!
kalvaro's profile image kalvaro posted 10 years ago Permalink
Sorry but I don't feel like re-typing everything. Here's my test code:

DROP TABLE IF EXISTS foo;
CREATE TABLE foo (
foo_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
as_default VARCHAR(50),
as_utf8 VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci,
as_gbk VARCHAR(50) CHARACTER SET gbk COLLATE gbk_chinese_ci,
PRIMARY KEY (foo_id)
)
ENGINE=InnoDB CHARACTER SET latin1 COLLATE latin1_general_ci;
INSERT INTO foo (as_default, as_utf8, as_gbk) VALUES ('仙俳反窃生地回火金拠況輸。', '仙俳反窃生地回火金拠況輸。', '仙俳反窃生地回火金拠況輸。');
SELECT *
FROM foo;


I cannot reproduce the issue.
kalvaro's profile image kalvaro posted 10 years ago Permalink
Related: http://code.google.com/p/heidisql/issues/detail?id=3524
[expired user #7812]'s profile image [expired user #7812] posted 10 years ago Permalink
Excuse me for my stupid.
thank you a lot.
Good life of peace.

Please login to leave a reply, or register at first.