Skip to content

Utf8JsonWriter does not respect RFC8259 #28712

@ycrumeyrolle

Description

@ycrumeyrolle

The RFC8259 define as follow the character escaping:
https://tools.ietf.org/html/rfc8259#section-7

All Unicode characters may be placed within the quotation marks, except for the characters that MUST be escaped: quotation mark, reverse solidus, and the control characters (U+0000 through U+001F).

unescaped = %x20-21 / %x23-5B / %x5D-10FFFF
Meaning that the escaped characters MUST be %x00-19 / %x22 / %x5C

Currently, the Utf8JsonWriter is escaping too much:
unescaped = %x00-19 / %x22 / %x26 / %x27 %x2B / %x3C / %x3E / %x5C / %x61 / %x7F / %x80-FF

If the reason is for security, you may propose as a JsonWriterOptions a strict character table, and a safer character table.

Related to #28567
@ahsonkhan

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions