## ๐ Bug: Mail search fails with diacritics in Safari (macOS) โ "Could not open folder"
Steps to reproduce
๐ฆ Environment
- Nextcloud version: 33
- Mail app version: 5.7.12
- Mail server: Dovecot (IMAP)
- OS: macOS
- Browser: Safari (latest version)
- Works in: Edge (Windows) โ
- Fails in: Safari (macOS) โ
๐งฉ Description
When using the search function in the Mail app with diacritics (non-ASCII characters), the search fails and displays the error:
"Could not open folder" (Sloลพku nebylo moลพnรฉ otevลรญt)
The same search works correctly without diacritics and also works in other browsers (Edge on Windows).
Expected behavior
โ Expected behavior
Search should work regardless of diacritics and return matching emails.
Actual behavior
โ Actual behavior
- Search with diacritics fails
- UI shows misleading error: "Could not open folder"
- No results returned
Mail app version
5.7.12
Nextcloud version
33.0.2
Mailserver or service
Dovecot
Operating system
OSX, safari, last actual version
PHP engine version
Other
Nextcloud memory caching
No response
Web server
Apache (supported)
Database
MariaDB
Additional info
๐ Additional notes
-
This appears to be related to encoding / IMAP SEARCH handling
-
Possibly caused by:
- incorrect UTF-8 handling
- Unicode normalization differences (Safari vs Chromium)
- improper escaping of IMAP search query
-
The error message is misleading โ the issue is not related to folders
๐ Browser-specific behavior
- Safari (macOS): โ fails with diacritics
- Edge (Windows): โ works correctly
This suggests a potential issue with how Safari encodes or sends the search query.
Thanks for the report.
Please look at your Nextcloud log and try to find the log lines written when the error happens. Post them.
{"reqId":"afCTDIDo3r_UCMVP2K4KogAAAFQ","level":3,"time":"2026-04-28T10:59:24+00:00","remoteAddr":"1xx.1xx.1.1","user":"anonym","app":"mail","method":"GET","url":"/index.php/apps/mail/api/messages?mailboxId=22&filter=to:hv%25C4%259Bzda+from:hv%25C4%259Bzda+subject:hv%25C4%259Bzda+body:hv%25C4%259Bzda+mentions:false+match:anyof+is:starred&limit=20&sort=newest&view=threaded","scriptName":"/index.php","message":"String contains non-ASCII characters.","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.4 Safari/605.1.15","version":"33.0.2.2","exception":{"Exception":"Horde_Imap_Client_Data_Format_Exception","Message":"String contains non-ASCII characters.","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Search/Query.php","line":292,"function":"__construct","class":"Horde_Imap_Client_Data_Format_String","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":2176,"function":"build","class":"Horde_Imap_Client_Search_Query","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/IMAP/Search/Provider.php","line":38,"function":"search","class":"Horde_Imap_Client_Base","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Service/Search/MailSearch.php","line":157,"function":"findMatches","class":"OCA\Mail\IMAP\Search\Provider","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Service/Search/MailSearch.php","line":121,"function":"getIdsLocally","class":"OCA\Mail\Service\Search\MailSearch","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Controller/MessagesController.php","line":161,"function":"findMessages","class":"OCA\Mail\Service\Search\MailSearch","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":205,"function":"index","class":"OCA\Mail\Controller\MessagesController","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":118,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/App.php","line":153,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Route/Router.php","line":321,"function":"main","class":"OC\AppFramework\App","type":"::"},{"file":"/var/www/html/nextcloud/lib/base.php","line":1155,"function":"match","class":"OC\Route\Router","type":"->"},{"file":"/var/www/html/nextcloud/index.php","line":25,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Data/Format/String.php","Line":73,"message":"String contains non-ASCII characters.","exception":"{"class":"Horde_Imap_Client_Data_Format_Exception","message":"String contains non-ASCII characters.","code":0,"file":"/var/www/html/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Data/Format/String.php:73","trace":"#0 /var/www/html/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Search/Query.php(292): Horde_Imap_Client_Data_Format_String->__construct()\n#1 /var/www/html/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php(2176): Horde_Imap_Client_Search_Query->build()\n#2 /var/www/html/nextcloud/apps/mail/lib/IMAP/Search/Provider.php(38): Horde_Imap_Client_Base->search()\n#3 /var/www/html/nextcloud/apps/mail/lib/Service/Search/MailSearch.php(157): OCA\Mail\IMAP\Search\Provider->findMatches()\n#4 /var/www/html/nextcloud/apps/mail/lib/Service/Search/MailSearch.php(121): OCA\Mail\Service\Search\MailSearch->getIdsLocally()\n#5 /var/www/html/nextcloud/apps/mail/lib/Controller/MessagesController.php(161): OCA\Mail\Service\Search\MailSearch->findMessages()\n#6 /var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(205): OCA\Mail\Controller\MessagesController->index()\n#7 /var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(118): OC\AppFramework\Http\Dispatcher->executeController()\n#8 /var/www/html/nextcloud/lib/private/AppFramework/App.php(153): OC\AppFramework\Http\Dispatcher->dispatch()\n#9 /var/www/html/nextcloud/lib/private/Route/Router.php(321): OC\AppFramework\App::main()\n#10 /var/www/html/nextcloud/lib/base.php(1155): OC\Route\Router->match()\n#11 /var/www/html/nextcloud/index.php(25): OC::handleRequest()\n#12 {main}"}","CustomMessage":"String contains non-ASCII characters."}} {"reqId":"afCTDOe-kaJILul3mefwkwAAARY","level":3,"time":"2026-04-28T10:59:24+00:00","remoteAddr":"1xx.1xx.1.1","user":"anonym","app":"mail","method":"GET","url":"/index.php/apps/mail/api/messages?mailboxId=22&filter=to:hv%25C4%259Bzda+from:hv%25C4%259Bzda+subject:hv%25C4%259Bzda+body:hv%25C4%259Bzda+mentions:false+match:anyof&limit=20&sort=newest&view=threaded","scriptName":"/index.php","message":"String contains non-ASCII characters.","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.4 Safari/605.1.15","version":"33.0.2.2","exception":{"Exception":"Horde_Imap_Client_Data_Format_Exception","Message":"String contains non-ASCII characters.","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Search/Query.php","line":292,"function":"__construct","class":"Horde_Imap_Client_Data_Format_String","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":2176,"function":"build","class":"Horde_Imap_Client_Search_Query","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/IMAP/Search/Provider.php","line":38,"function":"search","class":"Horde_Imap_Client_Base","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Service/Search/MailSearch.php","line":157,"function":"findMatches","class":"OCA\Mail\IMAP\Search\Provider","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Service/Search/MailSearch.php","line":121,"function":"getIdsLocally","class":"OCA\Mail\Service\Search\MailSearch","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Controller/MessagesController.php","line":161,"function":"findMessages","class":"OCA\Mail\Service\Search\MailSearch","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":205,"function":"index","class":"OCA\Mail\Controller\MessagesController","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":118,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/App.php","line":153,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Route/Router.php","line":321,"function":"main","class":"OC\AppFramework\App","type":"::"},{"file":"/var/www/html/nextcloud/lib/base.php","line":1155,"function":"match","class":"OC\Route\Router","type":"->"},{"file":"/var/www/html/nextcloud/index.php","line":25,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Data/Format/String.php","Line":73,"message":"String contains non-ASCII characters.","exception":"{"class":"Horde_Imap_Client_Data_Format_Exception","message":"String contains non-ASCII characters.","code":0,"file":"/var/www/html/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Data/Format/String.php:73","trace":"#0 /var/www/html/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Search/Query.php(292): Horde_Imap_Client_Data_Format_String->__construct()\n#1 /var/www/html/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php(2176): Horde_Imap_Client_Search_Query->build()\n#2 /var/www/html/nextcloud/apps/mail/lib/IMAP/Search/Provider.php(38): Horde_Imap_Client_Base->search()\n#3 /var/www/html/nextcloud/apps/mail/lib/Service/Search/MailSearch.php(157): OCA\Mail\IMAP\Search\Provider->findMatches()\n#4 /var/www/html/nextcloud/apps/mail/lib/Service/Search/MailSearch.php(121): OCA\Mail\Service\Search\MailSearch->getIdsLocally()\n#5 /var/www/html/nextcloud/apps/mail/lib/Controller/MessagesController.php(161): OCA\Mail\Service\Search\MailSearch->findMessages()\n#6 /var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(205): OCA\Mail\Controller\MessagesController->index()\n#7 /var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(118): OC\AppFramework\Http\Dispatcher->executeController()\n#8 /var/www/html/nextcloud/lib/private/AppFramework/App.php(153): OC\AppFramework\Http\Dispatcher->dispatch()\n#9 /var/www/html/nextcloud/lib/private/Route/Router.php(321): OC\AppFramework\App::main()\n#10 /var/www/html/nextcloud/lib/base.php(1155): OC\Route\Router->match()\n#11 /var/www/html/nextcloud/index.php(25): OC::handleRequest()\n#12 {main}"}","CustomMessage":"String contains non-ASCII characters."}}
I have a similar issue but just in the body of the search written here https://github.com/nextcloud/mail/issues/10572
I have created a pull request with recommandation of https://github.com/nextcloud/mail/issues/9257
https://github.com/nextcloud/mail/pull/12907
Thanks for the report.
Please look at your Nextcloud log and try to find the log lines written when the error happens. Post them. Hi Christoph, some progress in the solution?
thanks
"Exception":"Horde_Imap_Client_Data_Format_Exception","Message":"String contains non-ASCII characters."
This is the exception if you want to dive deeper. I don't have the capacity at the moment.
And now the same bug in chrome on WIN
Error mail Horde_Imap_Client_Data_Format_Exception: String contains non-ASCII characters. at 2026-08-24T06:53:16+00:00 .../lib/Horde/Imap/Client/Data/Format/String.php line 73
.../Imap/Client/Search/Query.php line 292
Hey @PeViz, are you still seeing this error with the latest Mail release? We released https://github.com/nextcloud/mail/pull/12907 meanwhile.
Hi there! It looks like this issue hasnโt seen much activity for a while and might need a bit more information to move forward. If we donโt hear back soon, we may close it to keep things organized. Thanks again for your contributions โ we really appreciate it!