Search code examples
ruby-on-railssqlitelocalecollation

How to sort text in sqlite3 with specified locale?


Sqlite3 by default sorts only by ascii letters. I tried to look in google, but the only thing I found were informations about collations. Sqlite3 has only NOCASE, RTRIM and BIARY collations. How to add support for a specific locale? (I'm using it in Rails application)


Solution

  • SQLite supports integration with ICU. According to the Readme file, sqlite/ext/icu/README.txt the sqlite/ext/icu/ directory contains source code for the SQLite "ICU" extension, an integration of the "International Components for Unicode" library with SQLite.

    1. Features
    
        1.1  SQL Scalars upper() and lower()
        1.2  Unicode Aware LIKE Operator
        1.3  ICU Collation Sequences
        1.4  SQL REGEXP Operator