Hi

I wanted to compare strings in a SQLite DB without caring for the accents
and the case. I mean "Événement" should be equal to "evenèment".

The ICU extension enables a case-insensitive LIKE, but 'é' will still be
different from 'É'. Anyway, using the ICU LIKE won't use any index, so I
was very reluctant to go this way.

The only solution I found was to patch the ICU extension[^1]. I added an
optional parameter to the function that creates a new collation: the
strength of the collation. Its default value is 3, and when I set it to
1, I get what I wanted.

    SELECT icu_load_collation('fr_FR', 'french');
    SELECT icu_load_collation('fr_FR', 'french_ci', 1); -- with patch

I first thought this was a very frequent need, so I had asked about this
on Stack Overflow, hoping for a quick answer. I ended up posting there a
detailed answer[^2].

I'm perfectly satisfied with this solution, but I thought I should share
it. I believe it could be merged into the ICU extension, because it
doesn't break compatibility, it just adds a new feature.

[^1]: <https://gist.github.com/mytskine/5028755>
[^2]: 
<http://stackoverflow.com/questions/15051018/localized-collate-on-a-sqlite-string-comparison>

Regards
--
François Gannaz
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to