Skip to content

ResponseHandling.cs incorrectly handles UTF-8 BOM #1766

@arontsang

Description

@arontsang

ResponseHandling.cs uses Encoding.GetString(byte[]) instead of using StreamReader.

This means that ResponseHandling ignores BOM handling and incorrectly parses the BOM preamble as 3 utf-8 characters.

Instead you should use

using var reader = new StreamReader(new MemoryStream(bytes), encoding);
return reader.ReadToEnd();

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions