Bug #30162 mysqldump has problem with latin2
Submitted: 31 Jul 2007 22:44 Modified: 8 Sep 2007 23:36
Reporter: Petr Neuman Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Backup Severity:S3 (Non-critical)
Version:5.0.44 OS:Linux
Assigned to: CPU Architecture:Any
Tags: mysqldump

[31 Jul 2007 22:44] Petr Neuman
Description:
Dumped data of table in charset latin2 is incorect.

How to repeat:
bash$ mysql -u okenko -p okenko
Server version: 5.0.44-log Gentoo Linux mysql-5.0.44

mysql> set names utf8;
Query OK, 0 rows affected (0.00 sec)

mysql> create table `test_latin2` (`text` varchar(10)) ENGINE=MyISAM DEFAULT CHARSET=latin2 COLLATE=latin2_czech_cs;
Query OK, 0 rows affected (0.77 sec)

mysql> insert into `test_latin2` values('ěščřžýáíé');
Query OK, 1 row affected (0.01 sec)

mysql> select hex(`text`), `text` from `test_latin2`;
+--------------------+--------------------+
| hex(`text`)        | text               |
+--------------------+--------------------+
| ECB9E8F8BEFDE1EDE9 | ěščřžýáíé |
+--------------------+--------------------+
1 row in set (0.00 sec)

mysql> exit
Bye

bash$ mysqldump --version
mysqldump  Ver 10.11 Distrib 5.0.44, for pc-linux-gnu (i686)

bash$ mysqldump -u okenko -p --skip-opt --set-charset --add-drop-table okenko test_latin2 > tmp.sql

bash$ mysql -u okenko -p okenko < tmp.sql

bash$ mysql -u okenko -p okenko
Server version: 5.0.44-log Gentoo Linux mysql-5.0.44

mysql> set names utf8;
Query OK, 0 rows affected (0.00 sec)

mysql> select hex(`text`), `text` from `test_latin2`;
+----------------+---------+
| hex(`text`)    | text    |
+----------------+---------+
| 3F3F3F3F3F3F3F | ??????? |
+----------------+---------+
1 row in set (0.00 sec)

Data with added parameter default-character-set for mysqldump
--default-character-set=utf8
3F3F3F3F3F3F3F  ???????
--default-character-set=binary
3F9A3F3F9EFDE1EDE9      ?????ýáíé
--default-character-set=latin2
3F3F3F3F3FFDE1EDE9      ?????ýáíé
[1 Aug 2007 8:14] Sveta Smirnova
Thank you for the report.

I can not repeat described behaviour. Additionally version 5.0.44 is a bit old. Please upgrade to current version 5.0.45 or 5.0.46, try with it and if you can repeat provide output of SHOW VARIABLES LIKE 'char%'
[1 Aug 2007 20:25] Petr Neuman
I tested this dump process on other machines with server and client version:

5.0.38-Ubuntu_0ubuntu1-log Ubuntu 7.04 distribution
5.0.45-community-nt

And on this machines is the same process correct.

I am sorry, i am not administrator of the system with 5.0.44 so i cant try 5.0.45 there.

Here are variables...

mysql> set names utf8;
mysql> SHOW VARIABLES LIKE 'char%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       | 
| character_set_connection | utf8                       | 
| character_set_database   | latin2                     | 
| character_set_filesystem | binary                     | 
| character_set_results    | utf8                       | 
| character_set_server     | latin1                     | 
| character_set_system     | utf8                       | 
| character_sets_dir       | /usr/share/mysql/charsets/ | 
+--------------------------+----------------------------+

kbash$ ls -l /usr/share/mysql/charsets/
total 228
-rw-r--r-- 1 root root 18173 Jul 17 00:36 Index.xml
-rw-r--r-- 1 root root  1758 Jul 17 00:36 README
-rw-r--r-- 1 root root  5480 Jul 17 00:36 armscii8.xml
-rw-r--r-- 1 root root  5466 Jul 17 00:36 ascii.xml
-rw-r--r-- 1 root root  7364 Jul 17 00:36 cp1250.xml
-rw-r--r-- 1 root root  8316 Jul 17 00:36 cp1251.xml
-rw-r--r-- 1 root root  5529 Jul 17 00:36 cp1256.xml
-rw-r--r-- 1 root root  8862 Jul 17 00:36 cp1257.xml
-rw-r--r-- 1 root root  5466 Jul 17 00:36 cp850.xml
-rw-r--r-- 1 root root  5482 Jul 17 00:36 cp852.xml
-rw-r--r-- 1 root root  5573 Jul 17 00:36 cp866.xml
-rw-r--r-- 1 root root  6489 Jul 17 00:36 dec8.xml
-rw-r--r-- 1 root root  5476 Jul 17 00:36 geostd8.xml
-rw-r--r-- 1 root root  5688 Jul 17 00:36 greek.xml
-rw-r--r-- 1 root root  5471 Jul 17 00:36 hebrew.xml
-rw-r--r-- 1 root root  5462 Jul 17 00:36 hp8.xml
-rw-r--r-- 1 root root  5489 Jul 17 00:36 keybcs2.xml
-rw-r--r-- 1 root root  5470 Jul 17 00:36 koi8r.xml
-rw-r--r-- 1 root root  6492 Jul 17 00:36 koi8u.xml
-rw-r--r-- 1 root root  9770 Jul 17 00:36 latin1.xml
-rw-r--r-- 1 root root  7192 Jul 17 00:36 latin2.xml
-rw-r--r-- 1 root root  5469 Jul 17 00:36 latin5.xml
-rw-r--r-- 1 root root  7398 Jul 17 00:36 latin7.xml
-rw-r--r-- 1 root root  8007 Jul 17 00:36 macce.xml
-rw-r--r-- 1 root root  8018 Jul 17 00:36 macroman.xml
-rw-r--r-- 1 root root  6490 Jul 17 00:36 swe7.xml
[1 Aug 2007 20:29] Petr Neuman
And variables before set names.

mysql> SHOW VARIABLES LIKE 'char%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | latin1                     | 
| character_set_connection | latin1                     | 
| character_set_database   | latin2                     | 
| character_set_filesystem | binary                     | 
| character_set_results    | latin1                     | 
| character_set_server     | latin1                     | 
| character_set_system     | utf8                       | 
| character_sets_dir       | /usr/share/mysql/charsets/ | 
+--------------------------+----------------------------+
[1 Aug 2007 20:32] Petr Neuman
creating of table test_latin2

Attachment: test_latin2_create.sql (text/x-sql), 187 bytes.

[8 Aug 2007 23:36] Sveta Smirnova
Thank you for the feedback.

I still can not repeat described behaviour. Please provide your configuration file.
[9 Sep 2007 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".