ICU - Order by case before character

80 views Asked by At

Using UCollator from ICU in C++, I want to order by case before everything else.

Despite setting the below options, the actual characters are considered before case.

ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_TERTIARY, &status);
ucol_setAttribute(coll, UCOL_CASE_FIRST, UCOL_LOWER_FIRST, &status);
ucol_setAttribute(coll, UCOL_CASE_LEVEL, UCOL_ON, &status);

The reason for this desired order is to replicate how C/C++ compares characters. An example being that B < a should be true, but ucol_strcollIter returns 1 (indicating B > a).

These are the results for some tests that I wrote, which should all pass:

A < a: FAIL
B < b: FAIL
a = a: PASS
B < a: FAIL
A < b: PASS
A < B: PASS

Any suggestion on how to configure UCollator to implement this would be much appreciated.

0

There are 0 answers