Bug #4417 | binary character set breaks multi-byte table/field name. | ||
---|---|---|---|
Submitted: | 6 Jul 2004 12:03 | Modified: | 3 Sep 2004 7:04 |
Reporter: | Alexander Barkov | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S1 (Critical) |
Version: | 4.1.x | OS: | Any (any) |
Assigned to: | Alexander Barkov | CPU Architecture: | Any |
[6 Jul 2004 12:03]
Alexander Barkov
[6 Jul 2004 12:05]
Alexander Barkov
Looks like Latin1 -> UTF8 conversion is applied, instead of copying AS IS.
[12 Jul 2004 22:25]
Shuichi Tamagawa
It is the same for database name.
[13 Jul 2004 6:46]
Shuichi Tamagawa
Hi bar, I just want to let you know that this problem also affects ENUM values in the result of 'SHOW CREATE TABLE', 'SHOW COLUMNS FROM' command and mysqldump program. How to repeat: shell> mysql --default-character-set=binary test mysql> CREATE TABLE t1(c1 enum('xxx','yyy','zzz')); #'xxx' is ujis 0xA4A2 #'yyy' is ujis 0xA4A4 #'zzz' is ujis 0xA4F3 mysql> SHOW CREATE TABLES t1; mysql> SHOW COLUMNS FROM t1; mysql> EXIT shell> mysqldump test t_enum --default-character-set=binary -u root MySQL converts... 0xA4A2 -> 0xC2A4C2A2 0xA4A4 -> 0xC2A4C2A4 0xA4F3 -> 0xC2A4C3B3
[19 Jul 2004 14:02]
Alexander Barkov
I verified this behaviour. The same happens with: CREATE TABLE t1 (a char(10) DEFAULT 'xxx'); I'm reopening the bug, will fix it asap.
[11 Aug 2004 11:12]
Alexander Barkov
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release. If necessary, you can access the source repository and build the latest available version, including the bugfix, yourself. More information about accessing the source trees is available at http://www.mysql.com/doc/en/Installing_source_tree.html Additional info: It's now fixed. After "SET NAMES binary" all metadata is sent in UTF8: column names, enum values, default values for both "SHOW CREATE TABLE" and "SHOW COLUMNS".
[3 Sep 2004 3:53]
Shuichi Tamagawa
Bar It seems that multi-byte table/field names are not accepted after this fix if "SET NAMES binary" is executed. When I create a table with Japanese characters, it returns "ERROR 1300 (HY000): Invalid utf8 character string: 'T1'". Is this the expected behavior after this fix? Try SET NAMES binary; CREATE TABLE t1(c1 char(5)); /* works fine */ CREATE TABLE `T1`(`C1` char(5)); /* returns error */ Note: This comment can be viewed in ujis(euc-jp) encoding.
[3 Sep 2004 7:04]
Alexander Barkov
Shuichi, yes it is expected behaviour. "SET NAMES binary" means no character set conversion is applied neither to data nor to meta-data (column, database, table names) when transferring from client to server. It means you have to provide correct table/field/database names in UTF-8. If you want to write names in UJIS, you should use "SET NAMES ujis". There are no other possible ways to write UJIS names.