From 12f52052920bb9677961870597d12f15331ebee0 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 | 7 +++++++ 2 files changed, 7 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..dce35fee8 100644 --- a/test/regression.txt +++ b/test/regression.txt @@ -275,3 +275,10 @@ Case fold test .

link

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

(￾￿)

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