From 24eac7c42fa3958abc1e51279d8b3f03d2eecfe9 Mon Sep 17 00:00:00 2001 From: Amniotic3 Date: Mon, 16 Dec 2024 13:39:22 +0800 Subject: [PATCH] Fix DB.inc.php/Emoji support If the note contains emoji emojis, then an error will be reported:. Invalid character in note Source line 1834 of /var/www/zotero/model/Item.inc.php After confirming that the database encoding is set correctly, look for errors in Zotero_DB ::query(), after testing, it is determined that the encoding is set incorrectly in line 252 of /var/www/zotero/include/DB.inc.php, and the error is eliminated by changing utf8 to utf8mb4. --- include/DB.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/DB.inc.php b/include/DB.inc.php index 1ee0170da..014cf5d43 100644 --- a/include/DB.inc.php +++ b/include/DB.inc.php @@ -249,7 +249,7 @@ private function getConnection($shardID, $info) { 'username' => $info['user'], 'password' => $info['pass'], 'dbname' => $info['db'], - 'charset' => !empty($info['charset']) ? $info['charset'] : 'utf8', + 'charset' => !empty($info['charset']) ? $info['charset'] : 'utf8mb4', 'driver_options' => [ "MYSQLI_OPT_CONNECT_TIMEOUT" => 5 ]