From 6009bba339b200abdec39cf73eefee633ba9cfde Mon Sep 17 00:00:00 2001 From: ColorfullyZhang <36832299+ColorfullyZhang@users.noreply.github.com> Date: Thu, 16 Sep 2021 14:41:24 +0800 Subject: [PATCH] Set mysql character set to utf8 explicitly to support chinese characters (or other special characters). --- src/zm_db.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/zm_db.cpp b/src/zm_db.cpp index 0d499edbd..c6cc452b9 100644 --- a/src/zm_db.cpp +++ b/src/zm_db.cpp @@ -102,6 +102,7 @@ bool zmDbConnect() { if ( mysql_query(&dbconn, "SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED") ) { Error("Can't set isolation level: %s", mysql_error(&dbconn)); } + mysql_set_character_set(&dbconn, "utf8"); zmDbConnected = true; return zmDbConnected; }