Bug #2077 accented characters in enum/defaul values are reported incorrectly
Submitted: 10 Dec 2003 7:30 Modified: 8 Jun 2004 11:36
Reporter: Sergei Golubchik Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version: OS:
Assigned to: Alexander Barkov CPU Architecture:Any

[10 Dec 2003 7:30] Sergei Golubchik
Description:
if there're accented characters in enum definition and/or default value, they are reported incorrectly by show create table or show columns

How to repeat:
mysql> CREATE TABLE t1 (licence enum('Ю faire','en cours','fait') character set latin1 NOT NULL default 'Ю faire');
Query OK, 0 rows affected (0.02 sec)

mysql> show create table inscriptions;
+--------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| Table        | Create Table                                                                                                                                |
+--------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| t1           | CREATE TABLE `t1` (
  `licence` enum('Ю faire','en cours','fait') NOT NULL default '? faire'
) TYPE=MyISAM DEFAULT CHARSET=latin1 |
+--------------+---------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)

mysql> show columns from t1;
+---------+-----------------------------------+------+-----+---------+-------+
| Field   | Type                              | Null | Key | Default | Extra |
+---------+-----------------------------------+------+-----+---------+-------+
| licence | enum('? faire','en cours','fait') |      |     | Ю faire |       |
+---------+-----------------------------------+------+-----+---------+-------+
1 row in set (0.02 sec)
[16 Dec 2003 6:09] Ramil Kalimullin
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
[8 Jun 2004 10:28] Alexander Barkov
Shuichi wrote:

There is still the same problem with
Japanese (or multi-byte) characters in 4.1.2. Appearently, the problem
happens under the following condition.

*Character set is ujis, sjis (or maybe other multi-byte character set)
*There is preceding column defined with NOT NULL restriction.
 
I'm not sure if this is related but the same problem happens to
the CREATE TABLE statement in the dump file created by mysqldump.
 
#Case 1 : The characters are shown correctly.
mysql> CREATE TABLE t_enum(a CHAR(1), b ENUM('XXX','YYY'));
mysql> SHOW CREATE TABLE t_enum;
mysql> EXIT
shell> mysqldump test t_enum --default-character-set=ujis -u root

#Case 2 : The characters turn into '??'
mysql> CREATE TABLE t_enum(a CHAR(1) NOT NULL, b ENUM('XXX','YYY'));
mysql> SHOW CREATE TABLE t_enum;
mysql> EXIT
shell> mysqldump test t_enum --default-character-set=ujis -u root

Note: 'XXX'= _ujis 0xA4A2, 'YYY'= _ujis 0xA4A4
[8 Jun 2004 10:30] Alexander Barkov
The above happens not only in mysqldump, but also in
SHOW CREATE TABLE results.