I've downloaded and compiled icu.c according to the instructions in the included README (though I had to add -fPIC to the compiler options).

Now, when searching a table, I'm not getting the kind of diacritic-insensitive behavior I was expecting:

sqlite> .load lib/libSQLiteICU.so
sqlite> select * from owner where firstname like '%dré%';
id    firstname      last  emai  phon  netid
----  -------------  ----  ----  ----  -------------
2     André-Marie   Ampère  amp...@example.com  555-2222  ampere
sqlite> select * from owner where firstname like '%dre%';

I expected both statements to return the same result. Am I overlooking something or do I misunderstand the capabilities of ICU's "unicode-aware LIKE operator"?

To get the diacritic-insensitive behavior you're after, you can follow previous advice and implement the Unicode Collation Algorithm.

Alternatively and if you're ready to accept some cut corners, you can try a small SQLite extension I wrote to this effect. It contains a fair range of Unicode-aware string functions and contrary to ICU, focusses on locale-independant behavior (which was what I needed at the time).

It uses simplified Unicode v5.1 tries for upper, lower, title, proper cases, unfolding, unaccenting, various collations, fuzzy compare and much more (LIKE, GLOB, ...). It works decently well with norm-C strings but will give surprising results with other forms of normalization. It's faster than ICU/UCA and has a much smaller footprint (~180Kb).

It comes as an archive with public domain C source code and ready to use Win32 DLL so that you can try it using a third-party SQLite manager (e.g. SQLite Expert) without having to write a single line of code or compile anything tricky.

Discussion of all functions can be found at top of the source file.
Download <http://dl.dropbox.com/u/26433628/unifuzz.zip>here anytime.

I always appreciate when people report bugs and/or usefulness for specific languages.


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to