Bug #9637 mysql->charset doesn't change after SET NAMES
Submitted: 5 Apr 2005 7:04 Modified: 15 Apr 2014 11:43
Reporter: Georg Richter Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S3 (Non-critical)
Version:4.1 and abvoe OS:Any (all)
Assigned to: Assigned Account CPU Architecture:Any
Tags: affects_connectors

[5 Apr 2005 7:04] Georg Richter
Description:
When sending "SET NAMES ... " command to the server, mysql->charset doesn't change.

mysql_real_escape_string (escape_string_for_mysql) uses mysql->charset to escape strings, but uses always the default character set.

How to repeat:
SET NAMES GBR

now try to escape 0xbf27 via mysql_real_escape_string which is a valid gbr char (0x27 = Backslash)
[5 Apr 2005 13:25] Sergei Golubchik
this is one part of the http://bugs.mysql.com/bug.php?id=8317
[6 Apr 2005 3:57] Jorge del Conde
Verified w/4.1 from bk
[15 Apr 2005 3:24] xuefer tinys
auto-reconnect have more problem. current implement seems lost charset state on reconnection
[12 Jul 2005 16:43] Georg Richter
Currently the client protocol doesn't support this feature. After sending SET NAMES statement to the server the server just sends an OK packet.

As a workaround you can use the api function mysql_set_charset_name (available since MySQL 4.1.13 and MySQL 5.0.10).
[15 Apr 2014 11:43] Erlend Dahl
[14 Apr 2014 21:57] Vamsikrishna Bhagi

Fixed as part of WL#4797.