MySQL 4.1 and Unicode : Still some puzzles to solve
I was all excited when I realized that MySQL 4.1 (http://www.mysql.com/) finally support Unicode. I always want to write an application that can store information in English, Japanese, Traditioanl Chinese and Simplied Chinese, all in a single filed. For instance, I have customers from mainland China and Japan, and I want to store the customer name in the same table field. I cannot do this without the help of Unicode.So I installed it and try it put it in the test. I also downloaded the new SQLyog 4.0 (http://www.webyog.com), the best MySQL GUI which is now a freeware software (for all the regular features.
The first thing I recognize was that SQLyog 4.0 still doesn't support Unicode on the UI. So that pretty much rule out my plan of using it to develop my multilingual application.
That means I have to use the console (mysql.exe) instead.
I logged in using the default root user (I know. I know. I will change it later :-P ) .... and created the following table:
> mysql.exe -h localhost -u root -p
use test
CREATE TABLE `test_utf8` (
`TestLang` varchar(100) NOT NULL,
`TestText` varchar(100) ,
`remark` varchar(100),
PRIMARY KEY (`TestLang`),
UNIQUE KEY `TestLang` (`TestLang`)
) ENGINE=InnoDB CHARACTER SET utf8
;
And then I try to insert some values:
insert into test_utf8 (TestLang, TestText) values ('Trad Chinese', '香港人想看港產電影');
insert into test_utf8 (TestLang, TestText) values ('Japanese', '横須賀まりこちゃんのギャラリーです');
insert into test_utf8 (TestLang, TestText) values ('Simp Chinese', '历史最高在线纪录');
But when I try to read the data back:
select * from test_utf8
I got everything in "????" except the traditioanl Chinese characters. Well I am using a US Windows XP OS and set all non-Unicode apps to treat all double characters as Traditional Chinese. I don't if that matters.
If I use "set names 'utf8' ", even the Traditional Chinese characters will become garbage. I have to "correct" it by using "set names 'default'" .
I tried Control Center and MySQL QueryBrowser, and I still cannot get Japanese and Simplified Chinese result.
So as for now, I guess I'll fall back to the plan B solution: Microsoft Access 2003. At least on the UI I see three different lanaguage on the gridbox at the same time.
I know. Sad. I'll visit it this issue again when I have time.

0 Comments:
Post a Comment
<< Home