Bug #20027 Wrong character set in error messages
Submitted: 23 May 2006 20:52 Modified: 30 May 2006 5:15
Reporter: Marko Mäkelä Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Charsets Severity:S3 (Non-critical)
Version:4.1, 5.0, 5.1 OS:Any (all)
Assigned to: CPU Architecture:Any

[23 May 2006 20:52] Marko Mäkelä
Description:
When error messages contain non-ASCII characters, they are often transmitted in the wrong encoding.

How to repeat:
set charset latin1;
drop table äö;
ERROR 1051 (42S02): Unknown table 'äö'

-- The table name is transmitted in multibyte UTF-8 encoding, even though the connection is using a 8-bit encoding (Windows-1252, "latin1").

Suggested fix:
Any non-ASCII error strings or %s parameters should be translated from UTF-8 to the connection character set. All error messages should be encoded in UTF-8, because identifiers are already encoded in that character set. Thus, the character set conversion can take place after substituting the parameters in the error message and before transmitting the message.
[25 May 2006 12:59] MySQL Verification Team
Thank you for the bug report. Verified as described:

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

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

mysql> set charset latin1;
Query OK, 0 rows affected (0.00 sec)

mysql> drop table äö;
ERROR 1051 (42S02): Unknown table 'äö'
mysql>
[30 May 2006 5:15] Alexander Barkov
Duplicate with:

http://bugs.mysql.com/bug.php?id=1406