Tailoring a sort order algorithm

Updated: April 19, 2023

If none of the standard CLDR locale files defines exactly the sort order you require, you can tailor the character weights in an existing file, which you can then save and convert to use in your custom implementation.

The POSIX format for sort order files is a processed output with explicit weights already assigned to the sort order. It may be simplest, therefore, to tailor a sort order by modifying the XML file from which a sort order file was generated.

That is, to tailor a sort order:

  1. Download from unicode.org/repos/cldr/trunk/docs/web/repository_access.html and unzip the files for the latest release:
    • the XML/LDML files (core.zip)
    • the Java tools for generating POSIX files from the XML files (tools.zip)
  2. Open the XML file for the sort order you want to change and tailor the character weights as required.
  3. Use the GeneratePOSIX utility from the Java tools download to generate a POSIX file with the tailored sort order.
  4. Use the QNX mkcldr utility to convert the new POSIX file to a binary file suitable for the libqdb_cdlr.so, as explained above in Converting CLDR POSIX files.
Note: To use your new (language_LOCALE.UTF-8.src) file, it must be in the /etc/cldr directory or the directory specified by $QDB_CLDR_PATH, as required by your system configuration. Ensure, then, that the new file is copied to this location, either as part of the XML to POSIX conversion with mkcldr, or by a simple file copy afterwards.