Search code examples
sqlsqlitesql-likeuppercaselowercase

Is this a bug in sqlite?


I have following query for Czech language:

select Id,Name 
from Account 
where Name like '%Še%'

it will return me correct result. But if I change Š to š in my query:

select Id,Name 
from Account 
where Name like '%še%'

It returns nothing. Is this a sqlite bug?


Solution

  • https://www.sqlite.org/lang_expr.html#like:

    Important Note: 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. The ICU extension to SQLite includes an enhanced version of the LIKE operator that does case folding across all unicode characters.

    So the solution to your problem would be to get an SQLite version with the ICU extension.