Set mysql character set to utf8 explicitly to support chinese characters (or other special characters).

This commit is contained in:
ColorfullyZhang 2021-09-16 14:41:24 +08:00 committed by Isaac Connor
parent c233ec3b8c
commit 874552c06b
1 changed files with 1 additions and 0 deletions

View File

@ -102,6 +102,7 @@ bool zmDbConnect() {
if ( mysql_query(&dbconn, "SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED") ) { if ( mysql_query(&dbconn, "SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED") ) {
Error("Can't set isolation level: %s", mysql_error(&dbconn)); Error("Can't set isolation level: %s", mysql_error(&dbconn));
} }
mysql_set_character_set(&dbconn, "utf8");
zmDbConnected = true; zmDbConnected = true;
return zmDbConnected; return zmDbConnected;
} }