You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Mail sync not working due to charset issue. #13696
while syncing mail account using mail:account:sync <account_id> throwing error like,
Sync failed for 30:INBOX: An exception occurred while executing a query: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value: '\xF0\x9F\xA7\x91\xF0\x9F...' for column nextcloud.oc_mail_messages.subject at row 1
After searching little bit I tried to change charset and collation in database manually and repairing next cloud instance, deleting and recreating mail account, non of it worked.
only after adding "'dbdriveroptions' => array( 1002 => 'SET NAMES utf8mb4 COLLATE utf8mb4_general_ci' )," to nextcloud's config.php. Syncing started working.
So, I guess the issue might be either in mysql configuration is not connecting using utf8mb4 or either the pdo is not connected using utf8mb4.
I have already seen your earlier bug of 2020 but the issue is still persist, may be...
Pardon me for my bad English and/or less knowledge on mysql/pdo connections.
It seems that MariaDB rejects the 4-byte emoji \xF0\x9F\xA7\x91 in oc_mail_messages.subject, which gives the 1366 Incorrect string value error.
Remove the dbdriveroptions hack and run occ db:convert-mysql-charset. It checks that the database supports utf8mb4, sets mysql.utf8mb4 = true and converts the tables.
Activity
kesselb commentedon Sep 25, 2026
Thanks for the report 🙏
It seems that MariaDB rejects the 4-byte emoji \xF0\x9F\xA7\x91 in oc_mail_messages.subject, which gives the 1366 Incorrect string value error.
Remove the dbdriveroptions hack and run occ db:convert-mysql-charset. It checks that the database supports utf8mb4, sets mysql.utf8mb4 = true and converts the tables.