From 80e9d1ffbd54126246be1a59f762f09997936234 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Tue, 23 Apr 2024 19:52:09 +0200 Subject: [PATCH] utf8: Fix encoding of U+FFFE and U+FFFF Fixes #548. --- src/utf8.c | 6 ------ test/regression.txt | 8 ++++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/utf8.c b/src/utf8.c index 95f87e58c..48697c77d 100644 --- a/src/utf8.c +++ b/src/utf8.c @@ -199,12 +199,6 @@ void cmark_utf8proc_encode_char(int32_t uc, cmark_strbuf *buf) { dst[0] = (uint8_t)(0xC0 + (uc >> 6)); dst[1] = 0x80 + (uc & 0x3F); len = 2; - } else if (uc == 0xFFFF) { - dst[0] = 0xFF; - len = 1; - } else if (uc == 0xFFFE) { - dst[0] = 0xFE; - len = 1; } else if (uc < 0x10000) { dst[0] = (uint8_t)(0xE0 + (uc >> 12)); dst[1] = 0x80 + ((uc >> 6) & 0x3F); diff --git a/test/regression.txt b/test/regression.txt index 71efb24e6..75196d48d 100644 --- a/test/regression.txt +++ b/test/regression.txt @@ -275,3 +275,11 @@ Case fold test .

link

```````````````````````````````` + +https://github.com/commonmark/cmark/issues/548 +```````````````````````````````` example +(￾￿) +. +

(￾￿)

+```````````````````````````````` +