Merge pull request #3355 from ColorfullyZhang/master

Set mysql character set to utf8 explicitly
This commit is contained in:
Isaac Connor 2021-09-16 09:49:19 -04:00 committed by GitHub
commit 1700e2f919
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -107,6 +107,7 @@ sub zmDbConnect {
.$socket . $sslOptions . ($options?join(';', '', map { $_.'='.$$options{$_} } keys %{$options} ) : '') .$socket . $sslOptions . ($options?join(';', '', map { $_.'='.$$options{$_} } keys %{$options} ) : '')
, $ZoneMinder::Config::Config{ZM_DB_USER} , $ZoneMinder::Config::Config{ZM_DB_USER}
, $ZoneMinder::Config::Config{ZM_DB_PASS} , $ZoneMinder::Config::Config{ZM_DB_PASS}
, { mysql_enable_utf8 => 1, }
); );
}; };
if ( !$dbh or $@ ) { if ( !$dbh or $@ ) {

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;
} }