diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index f492dd2c4..6f6db6acc 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -22,6 +22,7 @@ 7.4.20 - fix: Assets with no committed versions may be left as orphans when parent is purged - fix: Tag cloud limited was to 50 least commonly used tags + - Use UTF8 for database connection when connecting to MySQL 7.4.19 - fix: Import Package does nothing when re-importing trashed package diff --git a/lib/WebGUI/SQL.pm b/lib/WebGUI/SQL.pm index bf82d1442..9ca83554d 100644 --- a/lib/WebGUI/SQL.pm +++ b/lib/WebGUI/SQL.pm @@ -319,7 +319,13 @@ sub connect { my $pass = shift; my $params = shift; - my $dbh = DBI->connect($dsn,$user,$pass,{RaiseError=>0,AutoCommit=>1 }); + my $driver; + if ($dsn =~ /^dbi:(\w+):/i) { + $driver = $1; + } + my $dbh = DBI->connect($dsn,$user,$pass,{RaiseError => 0, AutoCommit => 1, + $driver eq 'mysql' ? (mysql_enable_utf8 => 1) : (), + }); unless (defined $dbh) { $session->errorHandler->error("Couldn't connect to database: $dsn");