Skip to content

Commit eeea476

Browse files
authored
fix: JUnit reporter was encoding xml files in UTF-16 instead of UTF-8 (#4001)
* fix: JUnit reporter * Enforce UTF-8 instead of UTF-16
1 parent f8d9e79 commit eeea476

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

TUnit.Engine/Xml/JUnitXmlWriter.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static string GenerateXml(
3333
?.FrameworkDisplayName
3434
?? RuntimeInformation.FrameworkDescription;
3535

36-
using var stringWriter = new StringWriter();
36+
using var stringWriter = new Utf8StringWriter();
3737
var settings = new XmlWriterSettings
3838
{
3939
Indent = true,
@@ -341,6 +341,11 @@ private static TestSummary CalculateSummary(IEnumerable<TestNodeUpdateMessage> t
341341
}
342342
}
343343

344+
file sealed class Utf8StringWriter : StringWriter
345+
{
346+
public override Encoding Encoding => Encoding.UTF8;
347+
}
348+
344349
internal sealed class TestSummary
345350
{
346351
public int Total { get; set; }

0 commit comments

Comments
 (0)