Description:
Inserting capital C with caron (cp1250 code 0x200) results in inserting cp852 (AC) code into UTF8 table.
How to repeat:
Start server with default-character-set=utf8
mysql> create database issues default character set=utf8;
Query OK, 1 row affected (0.05 sec)
mysql> use issues;
Database changed
mysql> set names cp1250;
Query OK, 0 rows affected (0.00 sec)
mysql> CREATE TABLE `t` (
-> `a` varchar(40) default NULL
-> ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.01 sec)
mysql> show variables like "%char%";
+--------------------------+-----------------------------------------------------------+
| Variable_name | Value
|
+--------------------------+-----------------------------------------------------------+
| character_set_client | cp1250
|
| character_set_connection | cp1250
|
| character_set_database | utf8
|
| character_set_results | cp1250
|
| character_set_server | utf8
|
| character_set_system | utf8
|
| character_sets_dir | /home/Tonci/bkwork/copyto/mysql-4-1/share/mysql/charsets/ |
+--------------------------+-----------------------------------------------------------+
7 rows in set (0.00 sec)
mysql> insert into t values ("Č"); #ALTx0200, my windows console is being polite
Query OK, 1 row affected (0.00 sec)
mysql> select * from t;
+------+
| a |
+------+
| Č |
+------+
1 row in set (0.02 sec)
mysql> select HEX(a) from t;
+--------+
| HEX(a) |
+--------+
| C2AC |
+--------+
1 row in set (0.00 sec)
# Wrong UTF8 value for capital C with caron.
mysql> INSERT INTO t VALUES (_cp1250 0xC8);
Query OK, 1 row affected (0.00 sec)
mysql> select * from t;
+------+
| a |
+------+
| Č |
| ╚ |
+------+
2 rows in set (0.00 sec)
mysql> SELECT HEX(a) from t;
+--------+
| HEX(a) |
+--------+
| C2AC |
| C48C |
+--------+
2 rows in set (0.00 sec)
The later is correct UTF8 value for capital C with caron.
Suggested fix:
?