Skip to content

Fix missing HTML entities in EPUB and MOBI text - #276

Open
loneshu7 wants to merge 1 commit into
binbyu:masterfrom
loneshu7:codex/fix-book-html-entities
Open

Fix missing HTML entities in EPUB and MOBI text#276
loneshu7 wants to merge 1 commit into
binbyu:masterfrom
loneshu7:codex/fix-book-html-entities

Conversation

@loneshu7

Copy link
Copy Markdown

Summary

  • Reparse formatted EPUB and MOBI documents with the HTML parser.
  • Preserve HTML named entities such as curly quotation marks in extracted book text.
  • Remove an unused second serialization in the MOBI parsing path.

Root cause

htmlDocDumpMemoryFormat can serialize typographic punctuation such as “” as HTML named entities. The formatted document was then passed to xmlReadMemory, but the XML parser only recognizes XML's predefined entities. With recovery enabled, unsupported HTML entities were silently discarded before the text reached pagination and rendering.

Using htmlReadMemory for the second parse keeps the parser consistent with the serialized format and preserves those characters.

User impact

EPUB and MOBI content no longer loses curly quotation marks and other HTML named entities during text extraction. This change does not modify font or transparent-window rendering.

Validation

  • Reproduced with an EPUB chapter containing curly quotation marks.
  • Confirmed the original parser removed the characters before layout/rendering.
  • x64 Release build completed successfully with MSVC v143 on Windows Server 2022.

@loneshu7
loneshu7 marked this pull request as ready for review August 19, 2026 02:38
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