Skip to content

Allow non-UTF-8 encodings #229

@Shane32

Description

@Shane32

The draft spec currently requires that UTF-8 is the one and only encoding supported by servers. See:

If the media type in a Content-Type or Accept header includes encoding information, then the encoding MUST be utf-8 (e.g. Content-Type: application/graphql-response+json; charset=utf-8). If encoding information is not included then utf-8 MUST be assumed.

This is at odds with the initial paragraph which says that additional formats may be supported:

The GraphQL specification allows for many serialization formats to be implemented. Servers and clients MUST support JSON and MAY support other, additional serialization formats.

I suggest relaxing the former paragraph a bit to indicate that utf-8 MUST be supported by servers and SHOULD be used for requests, and MUST be assumed if not specified, similar to requirements for the media type used by requests/responses.

I know that one of our users that has a need for a different encoding for requests. So at present, GraphQL.NET supports any encoding supported by the underlying operating system for requests, while responses currently are only UTF-8. (Note that I believe the JSON string escaping used by default would be such that it would also be ASCII compatible -- but I'd have to check to be sure.)

cc: @sungam3r

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions