Noah Hart <n...@lipmantpa.com> wrote:
> Number 2, your platform may not support the sqlite3_create_collation
> interface. For example, Firefox now includes SQLite. Unfortunately,
> while Firefox supports user defined functions, their implementation
> does not support user defined collations.
>
> Someone commented that the US lives in a 7-bit world.
> This means that the other 6 billion people on the planet do not.
>
> This creates a real problem for me.  I am writing a foreign language
> Firefox extension, and the issue of sorting is critical, since
> Firefox uses Unicode sorting, which does not "sort" (based on my
> rules) correctly.   This means I have no way to correct the sorting,
> except in the display routines.

This is not quite true. You say custom functions are supported: then you 
can do ORDER BY sortkey(textField), with a suitably defined sortkey() 
function (see strxfrm, LCMapString). You can't however build indexes 
using such a function, something you can do with a collation.

> That being said, I would not limit this feature to 8bit locales.  A
> more general solution would be to design it around a sqlite_collation
> master table in the database. An application developer (not the
> SQLite team) would be responsible to define and populate their "user
> defined" collation.

Sorting in many locales is not as simple as suitably ordering individual 
Unicode characters. E.g. in German phonebook order, letter ö (small o 
with umlaut aka diaresis) sorts as if it were two letters oe, that is od 
< ö < of. In French, strings are compared ignoring diacritics first, 
then ties are broken by considering diacritics right-to-left. In Spanish 
traditional sort, a pair ch sorts as if it were a single letter between 
c and d. Even in English, you would often want to sort co-op and coop, 
or cant and can't, in such a way that they are kept together.

Consider also things like combinig diacritics.

Igor Tandetnik 



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

Reply via email to