[Unicode]  Unicode Collation Algorithm

UCA Conformance Test


The following files provide conformance tests for the Unicode Collation Algorithm (UTS #10: Unicode Collation Algorithm).

These files are large, and thus packaged in zip format to save download time.


There are two different files, corresponding to two of the 3.2.2 Variable Weighting values.

The format is illustrated by the following example:

0385 0021; #GREEK DIALYTIKA TONOS [0209 0237|0047 0032 0020|0002 0002 0002|]

The part before the semicolon is the hex representation of a sequence of Unicode code points. After the hash mark is a comment. This comment is purely informational, and may change in the future. Currently it consists of the name of the first code point, followed by a representation of the  sort key for the sequence.

The sort key representation is in square brackets. It uses a vertical bar for the ZERO separator. Between the bars are the primary, secondary, tertiary, and quaternary weights (if any), in hex.

Note: The sort key is purely informational. UCA does not require the production of any particular sort key, as long as the results of comparisons match.


The files are designed so each line in the file will order as being greater than or equal to the previous one, when using the UCA and the Default Unicode Collation Element Table. A test program can read in each line, compare it to the last line, and signal an error if order is not correct. The exact comparison that should be used is as follows:

  1. Read the next line.
  2. Parse each sequence up to the semicolon, and convert it into a Unicode string.
  3. Compare that string with the string on the previous line, according to the UCA implementation.
  4. If the last string is less than the current string, continue to the next line (step 1).
  5. If the last string is greater than the current string, then stop with an error.
  6. Compare the strings in code point order.
  7. If the last string is greater than the current string, then stop with an error
  8. Continue to the next line (step 1).

If there are any errors, then the UCA implementation is not compliant.

  • This test is only valid for an untailored Default Unicode Collation Element Table.
  • In step 6, the strings are compared in code point order. Note that in the case of UTF-16, this is not binary order.