Skip to content

Keep rendering text after invalid UTF-8 bytes - #669

Open
wissaaamm wants to merge 1 commit into
commonmark:masterfrom
wissaaamm:fix/render-after-invalid-utf8
Open

wissaaamm wants to merge 1 commit into
commonmark:masterfrom
wissaaamm:fix/render-after-invalid-utf8

Conversation

@wissaaamm

Copy link
Copy Markdown

This addresses the encoding part of #662.

The shared renderer returned on a UTF-8 decoding error and silently dropped the rest of the text node in CommonMark, LaTeX, and man output. Emit U+FFFD for the undecodable byte and resume rendering at the next byte. This keeps the complete readable suffix even when parsing with the default options.

The API regression passes legacy-encoded text through all three renderers. All three assertions failed before the fix. The approved offline runner passed all 576 API assertions in a shared Debug build and a static UBSan build. The Python-based specification suite could not run because Python was unavailable in the native build image.

This change was prepared with AI assistance.

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 this pull request may close these issues.

1 participant