This repository has been archived by the owner on Sep 4, 2024. It is now read-only.
Properly handle escaping of markup text #1078
Open
+3
−2
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.
Previously, Xwt assumed that the platform (Gtk) handled
encoding/decoding of markup text that contains special
characters. GLib.Markup.EscapeText would do the escaping
and then Gtk itself would unescape when displayed.
Since we switched from the Gtk to the Cocoa backend, that
has two problems - GLib.Markup.EscapeText crashes if
Gtk isn't there and even if it does work, there's nothing on
the Cocoa side to unescape the text.
Instead we now handle all escaping/unescaping in a backend
independent way. WebUtility.HtmlEncode does the escaping
and cross platform Xwt markup parsing code does the match
WebUtility.HtmlDecode to unescape.
For this to fully work the Xwt change and VSMac change need
to both be present, but the VSMac update is the most important
as it removes the crash.
Also see https://github.com/xamarin/vsmac/pull/5824