Skip to content

JsonSummary contains Byte Order Mark (BOM) #481

@Chris-D-Turk

Description

@Chris-D-Turk

Describe the bug
The JsonSummary-Report contains a Byte Order Mark (BOM).
This is invalid JSON according to https://datatracker.ietf.org/doc/html/rfc8259#section-8.1

Implementations MUST NOT add a byte order mark (U+FEFF) to the
beginning...

Why am I reporting this?
I'm trying to parse the JsonSummary using the Jenkins Step readJSON, which fails because of the BOM 😢

Possible Fix
https://github.com/danielpalme/ReportGenerator/blob/main/src/ReportGenerator.Core/Reporting/Builders/JsonSummaryReportBuilder.cs

change
using (var reportTextWriter = new StreamWriter(new FileStream(targetPath, FileMode.Create), Encoding.UTF8))
to
using (var reportTextWriter = new StreamWriter(new FileStream(targetPath, FileMode.Create), new UTF8Encoding(encoderShouldEmitUTF8Identifier: false)))

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions