Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions test/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,30 @@ static void issue102(void) /* #102 */
check_compare("NFKC_Casefold", input, correct, utf8proc_NFKC_Casefold(input), 1);
}

static void issue317(void) /* #317 */
{
utf8proc_uint8_t input[] = {0xec, 0xa3, 0xa0, 0xe1, 0x86, 0xa7, 0x00}; /* "\uc8e0\u11a7" */
utf8proc_uint8_t combined[] = {0xec, 0xa3, 0xa, 0x00}; /* "\uc8e1" */
utf8proc_int32_t codepoint;

/* inputs that should *not* be combined* */
check_compare("NFC", input, input, utf8proc_NFC(input), 1);
utf8proc_encode_char(0x11c3, input+3);
check_compare("NFC", input, input, utf8proc_NFC(input), 1);

/* inputs that *should* be combined (TCOUNT-1 chars starting at TBASE+1) */
for (codepoint = 0x11a8; codepoint < 0x11c3; ++codepoint) {
utf8proc_encode_char(codepoint, input+3);
utf8proc_encode_char(0xc8e0 + (codepoint - 0x11a7), combined);
check_compare("NFC", input, combined, utf8proc_NFC(input), 1);
}
}

int main(void)
{
issue128();
issue102();
issue317();
#ifdef UNICODE_VERSION
printf("Unicode version: Makefile has %s, has API %s\n", UNICODE_VERSION, utf8proc_unicode_version());
check(!strcmp(UNICODE_VERSION, utf8proc_unicode_version()), "utf8proc_unicode_version mismatch");
Expand Down
2 changes: 1 addition & 1 deletion utf8proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_normalize_utf32(utf8proc_int32_t *b
(hangul_sindex % UTF8PROC_HANGUL_TCOUNT) == 0) {
utf8proc_int32_t hangul_tindex;
hangul_tindex = current_char - UTF8PROC_HANGUL_TBASE;
if (hangul_tindex >= 0 && hangul_tindex < UTF8PROC_HANGUL_TCOUNT) {
if (hangul_tindex > 0 && hangul_tindex < UTF8PROC_HANGUL_TCOUNT) {
*starter += hangul_tindex;
starter_property = NULL;
continue;
Expand Down