Fix mangled text after JSoup parsing - #5645
Merged
cwisniew merged 4 commits intoJun 27, 2025
Merged
Conversation
- Remove unused bits - Privatize things that don't need to be public - HTMLContent.content can actually be non-null - Inline injectJavaBridgeAndBaseUrl(null) into injectJavaBridge() - Inline injectUrlBase(String, URL) into injectUrlBase(URL)
Each content type is now represented by its own record class that contains only those fields it supports.
This ensures that the same conversions apply regardless of whether we happened to call injectJavaBridge() or similar.
Also means we don't need to convert HTML5 documents to a base64 `data:` url since the content won't contain surrogate pairs.
cwisniew
approved these changes
Jun 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Identify the Bug or Feature request
Fixes #5640
Description of the Change
The key change here is that the document output settings are now set to output ASCII text only. Any non-ASCII characters, including characters from resolved references - such as
•for•- will be replaced by entities (not necessarily the same entity, but an equivalent one).To make sure we don't end up in a situation where some code paths result in ASCII, while others keep the unicode characters, I've modifed
HTMLContentto always parse HTML documents, and to represent them asDocumentobjects instead of raw strings. When the string is needed,Document#html()will render it to a string, applying the output settings described above.As we're now guaranteed to have ASCII HTML documents, the base64
data:URL workaround from #5442 is no longer needed and has been removed.And since I was in the weeds here anyways, I removed the unused bits of
HTMLContent, encapsulated it more by making somepublicstuffprivate, and changedContentfrom a single record class representing many types to an ADT that represents each type as its own record class.Possible Drawbacks
The HTML content of frames and dialogs will not match the code provided by the macro author. This was already true, but now it's extra true. Although the result should be functionally equivalent, it may cause confusion if the loaded HTML source is ever viewed.
Documentation Notes
N/A
Release Notes
frame5,dialog5oroverlay.This change is