Next: , Previous: , Up: Normalization forms (composition and decomposition) <uninorm.h>   [Contents][Index]


13.4 Normalizing comparisons

The following functions compare Unicode string, ignoring differences in normalization.

Function: int u8_normcmp (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2, uninorm_t nf, int *resultp)
Function: int u16_normcmp (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2, uninorm_t nf, int *resultp)
Function: int u32_normcmp (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2, uninorm_t nf, int *resultp)

Compares s1 and s2, ignoring differences in normalization.

nf must be either UNINORM_NFD or UNINORM_NFKD.

If successful, sets *resultp to -1 if s1 < s2, 0 if s1 = s2, 1 if s1 > s2, and returns 0. Upon failure, returns -1 with errno set.

Function: char * u8_normxfrm (const uint8_t *s, size_t n, uninorm_t nf, char *resultbuf, size_t *lengthp)
Function: char * u16_normxfrm (const uint16_t *s, size_t n, uninorm_t nf, char *resultbuf, size_t *lengthp)
Function: char * u32_normxfrm (const uint32_t *s, size_t n, uninorm_t nf, char *resultbuf, size_t *lengthp)

Converts the string s of length n to a NUL-terminated byte sequence, in such a way that comparing u8_normxfrm (s1) and u8_normxfrm (s2) with the u8_cmp2 function is equivalent to comparing s1 and s2 with the u8_normcoll function.

nf must be either UNINORM_NFC or UNINORM_NFKC.

The resultbuf and lengthp arguments are as described in chapter Conventions.

Function: int u8_normcoll (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2, uninorm_t nf, int *resultp)
Function: int u16_normcoll (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2, uninorm_t nf, int *resultp)
Function: int u32_normcoll (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2, uninorm_t nf, int *resultp)

Compares s1 and s2, ignoring differences in normalization, using the collation rules of the current locale.

nf must be either UNINORM_NFC or UNINORM_NFKC.

If successful, sets *resultp to -1 if s1 < s2, 0 if s1 = s2, 1 if s1 > s2, and returns 0. Upon failure, returns -1 with errno set.


Next: Normalization of streams of Unicode characters, Previous: Normalization of strings, Up: Normalization forms (composition and decomposition) <uninorm.h>   [Contents][Index]