Perform string comparison after s1 and s2 have been normalized by using Unicode Normalization Form D.

U8_STRCMP_NFC

Perform string comparison after s1 and s2 have been normalized by using Unicode Normalization Form C.

U8_STRCMP_NFKD

Perform string comparison after s1 and s2 have been normalized by using Unicode Normalization Form KD.

U8_STRCMP_NFKC

Perform string comparison after s1 and s2 have been normalized by using Unicode Normalization Form KC.

Only one case-sensitive or case-insensitive option is allowed. Only one Unicode Normalization option is allowed.

unicode_version

The version of Unicode data that should be used during comparison. The following values are supported:

U8_UNICODE_320

Use Unicode 3.2.0 data during comparison.

U8_UNICODE_500

Use Unicode 5.0.0 data during comparison.

U8_UNICODE_LATEST

Use the latest Unicode version data available, which is Unicode 5.0.0.

errno

A non-zero value indicates that an error has occurred during comparison. The following values are supported:

EBADF

The specified option values are conflicting and cannot be supported.

EILSEQ

There was an illegal character at s1, s2, or both.

EINVAL

There was an incomplete character at s1, s2, or both.

ERANGE

The specified Unicode version value is not supported.

Description

After proper pre-processing, the u8_strcmp() function compares two UTF-8 strings byte-by-byte, according
to the machine ordering defined by the corresponding version of the Unicode
Standard.

When multiple comparison options are specified, Unicode Normalization is performed after case-sensitive
or case-insensitive processing is performed.

Return Values

The u8_strcmp() function returns an integer greater than, equal to, or less
than 0 if the string pointed to by s1 is greater than,
equal to, or less than the string pointed to by s2, respectively.

When u8_strcmp() detects an illegal or incomplete character, such character causes the
function to set errno to indicate the error. Afterward, the comparison is
still performed on the resultant strings and a value based on byte-by-byte
comparison is always returned.

Context

The u8_strcmp() function can be called from user or interrupt context.