0

Possible Duplicate:
SQLite 3: Character Issue While Ordering By Records

The default SQLite configuration does not support Turkish ordering.

What can I do in SQLite to order/sort according to the Turkish alphabet?

Community
  • 1
  • 1
Mustafa Güven
  • 15,526
  • 11
  • 63
  • 83
  • I reckon the only two ways are: a.) modify the source of SQLite (and preferably contribute back your change) or b.) do the sorting in code after retrieving the data. b.) is admittedly suboptimal. – 0xC0000022L Nov 25 '11 at 19:20
  • [similar question][1] [1]: http://stackoverflow.com/questions/7813069/sqlite-3-character-issue-while-ordering-by-records – Fatih Donmez Nov 25 '11 at 19:23
  • I have compiled SQLite for iOS with the required parameters to support Turkish. It worked fine but it does add 200 mb additional size to the app. – Ahmet Akkök Jun 05 '18 at 09:07

1 Answers1

1

ISTM the only two strategies a 1) teaching SQLite about Turkish ordering or 2) using an external tool that already knows.

For 1) you would need to build a table with the characterset in the proper collation order and use it to drive a correct sort. See section 6 Collation Sequences at http://www.sqlite.org/datatype3.html and the instructions for building a custom collation function: http://www.sqlite.org/c3ref/create_collation.html . A custom collation function would do lookups into your ordered character table to determine which of two strings precedes the other.

For 2) just dump a CSV file and handoff the work to Python or somesuch.

Raymond Hettinger
  • 216,523
  • 63
  • 388
  • 485