"Giulio Mastrosanti" <[email protected]>
wrote in message
news:[email protected]
> search * from table where description like '%cafe%'
>
> matches the descriptions containing cafe and CAFE, but also cafè and
> CAFÈ.
>
> now on sqlite not only I can't find the way to make the search accent
> insensitive ( so cafe will not match cafè ), but it seems from test
> and from some info discovered on the web that the search using LIKE is
> case insensitive only for ascii characters ( so cafe matches CAFE but
> cafè does not match CAFÈ ).

For the simple search, you can install a custom collation - see 
http://sqlite.org/c3ref/create_collation.html. However, LIKE operator 
doesn't use collations. It uses a function named "like" 
(http://sqlite.org/lang_corefunc.html): you can install your own 
(http://sqlite.org/c3ref/create_function.html). Alternatively, if you 
can change the statement, you can write a custom function (say, 
"normalize") that would return its argument lowercased and with accents 
removed. Then you can do

search * from table where normalize(description) like '%cafe%';

See also:

http://www.sqlite.org/cvstrac/fileview?f=sqlite/ext/icu/README.txt
http://sqlite.org/optoverview.html#like_opt

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to