Reputation: 9301
I'm building an application that is used to teach people French. When I try to sort some French words do not end up where I intended them to be, for example:
Will be sorted in the following order:
The SQL statement I'm currently using is:
SELECT name, assignment_id FROM GrammarAssignments ORDER BY name COLLATE NOCASE
Upvotes: 7
Views: 4696
Reputation: 3312
Just in case some one else comes across this post, I ran into the same issue and tested it. The below should do the trick of sorting depending on the locale as well as sorting case insensitive.
SELECT name, assignment_id FROM GrammarAssignments ORDER BY name COLLATE LOCALIZED ASC
Upvotes: 6
Reputation: 180172
Android's SQLite implementation has the LOCALIZED
and UNICODE
collations for this.
See the SQLite documentation for how to apply collations to table columns and SQL expressions.
Upvotes: 1