[asterisk-dev] [Code Review] Correct character encoding for MySQL connections in Realtime w/ MySQL

Olle E. Johansson oej at edvina.net
Sat Oct 2 02:34:26 CDT 2010


1 okt 2010 kl. 23.10 skrev Russell Bryant:

>> MySQL connection code used in res_config_mysql did not specify a character set, so data retrieved from the database was encoded incorrectly. I have added an optional configuration value which goes in res_mysql.conf which tells MySQL what character set to use when transmitting the data.  This bug was also present in the MYSQL dialplan application, so I have fixed it there as well.  Connection code both places now sends the specified character set (or "latin1" by default, as MySQL.com says this is the most commonly used character set) during connection and executes "SET NAME charset" immediately after connecting. Executing "SET NAMES charset" is necessary because it sets "character_set_connection" and "collation_connection" to the requested charsets instead of leaving them set to the default for the database which is being used.

Please check cdr_mysql as well. Caller ID Names in SIP and IAX2 is UTF8 by default...

Thanks,
/O


More information about the asterisk-dev mailing list