Mail sync not working due to charset issue.
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 348
- Avg merge
- 12h 28m
- Merged PRs (30d)
- 91
Description
Steps to reproduce
- 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.
Expected behavior
Now syncing.
Actual behavior
Not Syncing.
Mail app version
5.12.0
Nextcloud version
34.0.4
Mailserver or service
Custom IMAP
Operating system
Debian, turnkey installation
PHP engine version
PHP 8.2
Nextcloud memory caching
Redis
Web server
Apache (supported)
Database
MariaDB
Additional info
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the mail:account:sync <account_id> command and the reported subject-column error, then compare the behavior with the dbdriveroptions entry shown for config.php. Reproduce the sync using a message containing emoji or other 4-byte characters; done means syncing succeeds without requiring that manual configuration workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mariadb, php
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100