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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Xwt/Xwt/FormattedText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
using Xwt.Drawing;
using System.Text;
using System.Globalization;
using System.Net;

namespace Xwt
{
Expand Down Expand Up @@ -62,7 +63,7 @@ void ParseMarkup (string markup)
int last = 0;
int i = markup.IndexOf ('<');
while (i != -1) {
sb.Append (markup, last, i - last);
sb.Append (WebUtility.HtmlDecode (markup.Substring (last, i - last)));
if (PushSpan (formatStack, markup, sb.Length, ref i)) {
last = i;
i = markup.IndexOf ('<', i);
Expand All @@ -76,7 +77,7 @@ void ParseMarkup (string markup)
last = i;
i = markup.IndexOf ('<', i + 1);
}
sb.Append (markup, last, markup.Length - last);
sb.Append (WebUtility.HtmlDecode (markup.Substring (last, markup.Length - last)));
Text = sb.ToString ();
}

Expand Down