Bug #9418 DOS codepages not available
Submitted: 27 Mar 2005 10:47 Modified: 29 Sep 2005 19:21
Reporter: David L Lambert Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version:4.1, 3.x OS:Windows (Windows ME/2000)
Assigned to: MySQL Verification Team CPU Architecture:Any

[27 Mar 2005 10:47] David L Lambert
Description:
The MySQL command-line client under a Windows command prompt does not support the display or entry of those characters that are common to the Latin-1 charset and CP437 (the U.S. MS-DOS charset).  Under Win2k,  it's possible to enter accented characters using an international keyboard,  but MySQL treats those characters as if they were latin-1 and stores them incorrectly.

Windows also displays program output using CP437,  so Latin1 characters appear as semantically different other characters.  (WinME also displays characters using CP437 but does not allow switching the keyboard language for a DOS box.)

How to repeat:
Using MySQL server 4.1 under Linux, MySQL client for server 4.1 under Windows (accessed via CMD.EXE), and MySQL client for server 3.23 under Linux (accessed via PuTTY):

We have an empty table "test.yy" with two columns.

On Linux, insert a row:

mysql> INSERT INTO yy VALUES ( 1, "tío alemán" );
Query OK, 1 row affected (0.01 sec)

mysql> SELECT * FROM yy;
+------+------------+
| xí   | qù         |
+------+------------+
|    1 | tío alemán |
+------+------------+
1 row in set (0.01 sec)

On Windows, insert another row:

mysql> INSERT INTO yy VALUES ( 2, "tío alemán" );
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM yy;
+------+------------+
| xφ   | q∙         |
+------+------------+
|    1 | tφo alemßn |
|    2 | tío alemán |
+------+------------+
2 rows in set (0.01 sec)

On Linux, try to select all data:

mysql> SELECT * FROM yy;
ERROR 2000: Unknown MySQL error
mysql> SELECT * FROM yy WHERE xí=1;
+------+------------+
| xí   | qù         |
+------+------------+
|    1 | tío alemán |
+------+------------+
1 row in set (0.09 sec)

Suggested fix:
I plan to write a CP437 charset description fiel in the near future,  and will submit it to the developers when it's ready for use.
[29 Sep 2005 18:32] David L Lambert
Fixed in 5.x (or earlier?).  ("SET CHARSET cp850;", etc.)
[29 Sep 2005 19:21] MySQL Verification Team
On Linux:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10 to server version: 4.1.15-debug-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> insert into yy values (1,"tio alemán");
Query OK, 1 row affected (0.00 sec)

mysql> 

On Windows:

c:\mysql\bin>mysql -hhegel -umiguel -p test
Enter password: ****
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11 to server version: 4.1.15-debug-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

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

mysql> insert into yy values (2, "tio alemán");
Query OK, 1 row affected (0.00 sec)

mysql> select * from yy;
+------+------------+
| xí   | qù         |
+------+------------+
|    1 | tio alemán |
|    2 | tio alemán |
+------+------------+
2 rows in set (0.00 sec)

mysql>