bug-libunistring
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-libunistring] Incorrect NFKC case folding


From: Daurnimator
Subject: [bug-libunistring] Incorrect NFKC case folding
Date: Sat, 19 Nov 2016 14:20:45 +1100

I ran into what seems to be a case of incorrect NFKC case-folding.
e.g. 00AD SOFT_HYPHEN is meant to map to the empty string:

>From DerivedNormalizationProps.txt
00AD          ; NFKC_CF;                # Cf       SOFT HYPHEN

##############################################
$ cat main.c
#include <stdio.h>
#include <unicase.h>

int main() {
    uint8_t *before = "\xC2\xAD";
    size_t len = 20;
    uint8_t after[20] = {0};
    u8_casefold(before, 2, NULL, UNINORM_NFKC, after, &len);
    printf("Was: %s\tBecomes: %s\n", before, after);
    return 0;
}
$ gcc main.c -lunistring && ./a.out
Was: ­ Becomes: ­
$ gcc main.c -lunistring && ./a.out | xxd
00000000: 5761 733a 20c2 ad09 4265 636f 6d65 733a  Was: ...Becomes:
00000010: 20c2 ad0a                                 ...
##############################################



reply via email to

[Prev in Thread] Current Thread [Next in Thread]