Official SQLite docs state:
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.
I want to select records from local database by unicode string matching. But if I use 'LIKE' in the where clause, I found that sqlite is not work UPPER/LOWER with unicode. Can anyone tell me how to use string comparing case-insensitive? Thank you very much!
Select Id, Name From Customers Where Upper(Name) Like Upper('%Igor%')
Select Id, Name From Customers Where Upper(Name) Like '%IGOR%'
SELECT places.title FROM places WHERE UPPER(places.title) LIKE '%ДЕД%'; term = @params['term'].
force_encoding('utf-8').
gsub("'", "''").
upcase
...
Select * From Cities Where Upper(Name) Like Upper('%#{term}%')
I had the same problem using Portuguese Brazilian strings. Although the characters were special characteres (not ASCII-only), the input received from the Rhodes view was encoded with another encoding (Windows1252), so I needed to force it to be encoded like UTF-8:term = @params['term'].
force_encoding('utf-8').
gsub("'", "''").
upcase
...
Select * From Cities Where Upper(Name) Like Upper('%#{term}%')
- # define GlogUpperToLower(A) if( !((A)&~0x7f) ){ A = sqlite3UpperToLower[A]; }
+ # define GlogUpperToLower(A) if( !((A)&~0x7f) ){ A = sqlite3UpperToLower[A]; } if ( A >= 0x0410 && A <= 0x042f) { A += 0x20; }