Skip to content

Commit 8a81e3a

Browse files
String content emoji (#11386)
Test fix of high-ascii encoding.
1 parent 7d7a3c9 commit 8a81e3a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Mvc/Mvc.ViewFeatures/test/StringHtmlContentTest.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System.IO;
5+
using System.Text.Encodings.Web;
56
using Microsoft.Extensions.WebEncoders.Testing;
67
using Xunit;
78

@@ -22,5 +23,19 @@ public void WriteTo_WritesContent()
2223
Assert.Equal("HtmlEncode[[Hello World]]", writer.ToString());
2324
}
2425
}
26+
27+
[Fact]
28+
public void Emoji_EncodedCorrectly()
29+
{
30+
// Arrange & Act
31+
var tearsOfJoy = new StringHtmlContent("😂2");
32+
33+
// Assert
34+
using (var stringWriter = new StringWriter())
35+
{
36+
tearsOfJoy.WriteTo(stringWriter, HtmlEncoder.Default);
37+
Assert.Equal("😂2", stringWriter.ToString(), ignoreCase: true);
38+
}
39+
}
2540
}
2641
}

0 commit comments

Comments
 (0)