Android SQLite sort / order utf8
I have the following items in a SQLite table on Android (the table tab contains 1 column - "name")
Beta
Work
Úpal
User
If I have these items in SQL Server configured for Slovak and select * from tab order by name
it correctly outputs the item sorted as:
Beta
User
Úpal
Work
In Slovak, U with an accent - Ú should be sorted after U.
In SQLite on Android, it outputs them in the following order:
Beta
User
Work
Úpal
I understand what's going on, SQLite is probably comparing characters using character code, and Ú after that.
What can I do to make it sort my path? Is it possible? The SQLite docs on COLLATION state that basically all collations are binary comparison options and allow you to compare string data using memcmp (), regardless of the text encoding.
The SQLite C API allows you to set new sort sequences . These features are not displayed by the Android API, but at least it sets up two additional mappings:
In addition to the SQLite default
BINARY
collator, Android ships two more,LOCALIZED
which changes with the current system locale andUNICODE
which is a Unicode collation algorithm and is not adapted to the current language.