Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subject Search not accepting umlauts #239

Closed
Tarboy3000 opened this issue Jan 24, 2024 · 3 comments
Closed

Subject Search not accepting umlauts #239

Tarboy3000 opened this issue Jan 24, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Tarboy3000
Copy link

Given an email with a subject like
A subject with umlauts: Ä Ö Ü
searching via the query
subject:"Ä"
does not return the correct emails

Non-prefixed search seems to work with umlauts (which is the workaround I'm using currently), so searching Ö returns emails as expected.

@axllent
Copy link
Owner

axllent commented Jan 24, 2024

I can confirm the bug, thanks for reporting it.

@axllent axllent added the bug Something isn't working label Jan 24, 2024
axllent added a commit that referenced this issue Jan 25, 2024
…ters (#239)

The LIKE operator is case sensitive by default in SQLIte for unicode characters (outside of the ASCII range). This workaround assumes the searched unicode character matches the case of the field. General searches are not affected by this as everything is lowercased.
@axllent
Copy link
Owner

axllent commented Jan 25, 2024

It turns out this is a limitation of SQLite, and there is no ideal solution as the embedded SQLite Mailpit uses (to provide multi-platform support) does not include the ICU extension (I do not think it is possible).

SQLite only understands upper/lower case for ASCII characters by default. The LIKE operator is case sensitive by default for unicode characters that are beyond the ASCII range. For example, the expression 'a' LIKE 'A' is TRUE but 'æ' LIKE 'Æ' is FALSE.

General searches are not affected as the search index Mailpit creates is lowercased by Mailpit before storing it in the database, and the search is (or rather was) lowercased before searching, however when searching by a specific field (eg subject:"Ä") a match would not be found unless the subject contained a lowercase "ä".

I have added a work-around which now assumes the searched unicode character matches the case of unicode character in the subject field. General searches (that don't specify a field) are not affected by this as everything is lowercased, however subject, to, from etc are stored in their original case in the database. This will be included in the next release.

@axllent
Copy link
Owner

axllent commented Jan 27, 2024

@Tarboy3000 This workaround has been included in v1.13.1. I'll mark this issue as resolved (as much as it can be for the reasons I mentioned before regarding unicode characters and SQLite), however if you experience any issues caused by this then please let me know. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants