From e4a2fc2736ff59265dcbd1eca43990a71f47d395 Mon Sep 17 00:00:00 2001 From: Kenny Nielsen <3674690+Nikkelmann@users.noreply.github.com> Date: Thu, 12 Aug 2021 15:59:55 +0200 Subject: [PATCH] Only encode text once Html.ReplaceLineBreaks calls WebUtility.HtmlEncode internally, so the text gets encoded by this method. As far as I know, WebUtility.HtmlEncode and HttpUtility.HtmlEncode produces the same result (unlike WebUtility.UrlEncode and HttpUtility.UrlEncode which produces different results; see https://edi.wang/post/2018/11/25/netcore-webutility-urlencode-httputility-urlencode), so it should be safe to omit HttpUtility.HtmlEncode here. --- .../Views/Partials/grid/editors/textstring.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/editors/textstring.cshtml b/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/editors/textstring.cshtml index 77d92d6825..42972f64d8 100644 --- a/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/editors/textstring.cshtml +++ b/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/editors/textstring.cshtml @@ -4,7 +4,7 @@ @if (Model.editor.config.markup != null) { string markup = Model.editor.config.markup.ToString(); - markup = markup.Replace("#value#", Html.ReplaceLineBreaks(HttpUtility.HtmlEncode((string)Model.value.ToString())).ToString()); + markup = markup.Replace("#value#", Html.ReplaceLineBreaks((string)Model.value.ToString()).ToString()); if (Model.editor.config.style != null) {