diff --git a/PreMailer.Net/PreMailer.Net.Tests/AngleSharpTests.cs b/PreMailer.Net/PreMailer.Net.Tests/AngleSharpTests.cs new file mode 100644 index 00000000..295247e9 --- /dev/null +++ b/PreMailer.Net/PreMailer.Net.Tests/AngleSharpTests.cs @@ -0,0 +1,21 @@ +using AngleSharp; +using AngleSharp.Html.Parser; +using Xunit; + +namespace PreMailer.Net.Tests; + +public class AngleSharpTests +{ + [Fact] + public void HtmlDocument_ToHtml_ShouldNotEffectHtmlEntities() + { + string htmlEncoded = "<&> ©"; + string input = $"
{htmlEncoded}
"; + var document = new HtmlParser(new HtmlParserOptions() + { + IsNotConsumingCharacterReferences = true + }).ParseDocument(input); + var output = document.ToHtml(); + Assert.Equal(input, output); // use object to get full string output + } +} \ No newline at end of file diff --git a/PreMailer.Net/PreMailer.Net.Tests/PreMailerTests.cs b/PreMailer.Net/PreMailer.Net.Tests/PreMailerTests.cs index c34e915a..674d3462 100644 --- a/PreMailer.Net/PreMailer.Net.Tests/PreMailerTests.cs +++ b/PreMailer.Net/PreMailer.Net.Tests/PreMailerTests.cs @@ -643,7 +643,7 @@ public void MoveCSSInline_AcceptsStream() [Fact] public void MoveCssInline_GivenHtmlEncodedCharacters_RemainsEncoded() { - string htmlEncoded = "<&> "; + string htmlEncoded = "<&> ©"; string input = $"
{htmlEncoded}
"; var premailedOutput = PreMailer.MoveCssInline(input);