graphql-platform icon indicating copy to clipboard operation
graphql-platform copied to clipboard

`?sdl` returns file encoded as UTF-8 with BOM

Open tobias-tengler opened this issue 2 years ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

I was trying out the new relay compiler and ran into a weird unsupported character issue. After some research I found out it is due to our schema.graphql file having UTF-8 with BOM and not just UTF-8 encoding: https://github.com/facebook/relay/issues/3798#issuecomment-1085991645

Steps to reproduce

Download your GraphQL schema like this: curl localhost:5000/graphql?sdl -o ./src/schema.graphql

Relevant log output

No response

Additional Context?

The issue is this: https://github.com/ChilliCream/hotchocolate/blob/61936613166e64665ab29d873c965a68084eb0df/src/HotChocolate/Language/src/Language.SyntaxTree/Utilities/SyntaxPrinter.cs#L68

It should be new UTF8Encoding(false) instead of Encoding.UTF8.

Product

Hot Chocolate

Version

13.0.0-preview.15

tobias-tengler avatar Apr 01 '22 15:04 tobias-tengler

I can submit a PR, if there are no objections :)

tobias-tengler avatar Apr 01 '22 15:04 tobias-tengler

Sure ... do :)

michaelstaib avatar Apr 03 '22 21:04 michaelstaib

Fixed this in the relay compiler: https://github.com/facebook/relay/pull/3908, but I think it might still be good to also merge my PR here, since this might also cause issues with other tools...

tobias-tengler avatar May 18 '22 21:05 tobias-tengler

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 16 '22 00:09 stale[bot]