Skip to content
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
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

BretJohnson
Copy link
Collaborator

@BretJohnson BretJohnson commented Feb 2, 2022

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

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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants