Ticket #177 (closed defect: fixed)
utf8: mysql_set_character_set better set names utf8
| Reported by: | uvi | Owned by: | smoku |
|---|---|---|---|
| Priority: | major | Component: | storage |
| Version: | 2.1.19 | Keywords: | |
| Cc: | Tracforge_linkmap: | ||
| Blocking: | Blocked By: |
Description
According to http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html "If you are using the mysql client with auto-reconnect enabled (which is not recommended), it is preferable to use the charset command rather than SET NAMES". It's true.
After some idle storage_mysql.c reconnects with auto-reconnect and libmysql fallback to latin1 instead of utf8.
Solution is to use http://dev.mysql.com/doc/refman/5.0/en/mysql-set-character-set.html, this do set names and also set mysql->charset. After reconnect utf8 preserved.
//mysql_query(conn, "SET NAMES 'utf8'");
if (mysql_set_character_set(conn, "utf8")) {
log_write(drv->st->sm->log, LOG_ERR, "mysql: cannot set character set: %s", mysql_error(conn));
mysql_close(conn);
return st_FAILED;
}
Attachments
Change History
Note: See
TracTickets for help on using
tickets.