I've added a set of Unicode string comparison functions which use the collation rules of the current locale.
2009-03-07 Bruno Haible <br...@clisp.org> New module 'uninorm/u32-normcoll'. * lib/uninorm/u32-normcoll.c: New file. * modules/uninorm/u32-normcoll: New file. New module 'uninorm/u16-normcoll'. * lib/uninorm/u16-normcoll.c: New file. * modules/uninorm/u16-normcoll: New file. New module 'uninorm/u8-normcoll'. * lib/uninorm.h (u8_normcoll, u16_normcoll, u32_normcoll): New declarations. * lib/uninorm/u8-normcoll.c: New file. * lib/uninorm/u-normcoll.h: New file. * modules/uninorm/u8-normcoll: New file. New module 'uninorm/u32-normxfrm'. * lib/uninorm/u32-normxfrm.c: New file. * modules/uninorm/u32-normxfrm: New file. New module 'uninorm/u16-normxfrm'. * lib/uninorm/u16-normxfrm.c: New file. * modules/uninorm/u16-normxfrm: New file. New module 'uninorm/u8-normxfrm'. * lib/uninorm.h (u8_normxfrm, u16_normxfrm, u32_normxfrm): New declarations. * lib/uninorm/u8-normxfrm.c: New file. * lib/uninorm/u-normxfrm.h: New file. * modules/uninorm/u8-normxfrm: New file. ========================= new decls in lib/uninorm.h ================================= /* Converts the string S of length N to a string in locale encoding, in such a way that comparing uN_normxfrm (S1) and uN_normxfrm (S2) with memcmp2() is equivalent to comparing S1 and S2 with uN_normcoll(). NF must be either UNINORM_NFC or UNINORM_NFKC. */ extern char * u8_normxfrm (const uint8_t *s, size_t n, uninorm_t nf, char *resultbuf, size_t *lengthp); extern char * u16_normxfrm (const uint16_t *s, size_t n, uninorm_t nf, char *resultbuf, size_t *lengthp); extern char * u32_normxfrm (const uint32_t *s, size_t n, uninorm_t nf, char *resultbuf, size_t *lengthp); /* Compare 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, set *RESULT to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and return 0. Upon failure, return the error number. */ extern int u8_normcoll (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2, uninorm_t nf, int *result); extern int u16_normcoll (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2, uninorm_t nf, int *result); extern int u32_normcoll (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2, uninorm_t nf, int *result);