Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

U+FFFE and U+FFFF encoded wrongly #548

Closed
nwellnhof opened this issue Apr 23, 2024 · 0 comments · Fixed by #549
Closed

U+FFFE and U+FFFF encoded wrongly #548

nwellnhof opened this issue Apr 23, 2024 · 0 comments · Fixed by #549

Comments

@nwellnhof
Copy link
Contributor

cmark_utf8proc_encode_char was pasted from an old version of the utf8proc project and, for whatever reason, contains special handling of U+FFFE and U+FFFF, resulting in invalid serialization of these codepoints. This can be triggered when parsing numeric character references and with some renderers:

% python3 -c 'print(chr(0xFFFF))' |build/src/cmark -t commonmark |hexdump -C
00000000  ff 0a                                             |..|
00000002
% echo '' |build/src/cmark |hexdump -C
00000000  3c 70 3e ff 3c 2f 70 3e  0a                       |<p>.</p>.|
00000009

The expected UTF-8 sequence is EF BF BF.

nwellnhof added a commit to nwellnhof/cmark that referenced this issue Apr 23, 2024
nwellnhof added a commit to nwellnhof/cmark that referenced this issue Apr 23, 2024
@jgm jgm closed this as completed in #549 Apr 23, 2024
jgm pushed a commit that referenced this issue Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant