-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow unicode characters outside the Basic Multilingual Plane #214
Comments
I also was reading the spec and realised this. Given the paragraph around it:
It sounds to me an error of ignorance rather than intent. Rust formerly had JSON (which is probably the main inspiration for the GraphQL syntax) does Fortunately you can avoid that insanity by simply expressing values literally. There’s no real need for the escapes anyway once you get past U+001F ( Also currently the escapes listed ( The definition of the handling of
What does that even mean? Seriously, that doesn’t make sense. This stuff all suggests to me that it was written by someone with a poor understanding of Unicode. This spec gravely needs both editorial and technical review. I want to see how different implementations parse:
|
Thanks for bringing this up! Great thought process already happening. I agree that surrogate pairs is an obtuse API. I'd like to avoid it if possible, though there is one serious upside to consider: it mirrors JSON. That might not be enough to motivate it as the solution, but it certainly shouldn't be discredited. Here are some action items:
|
This clears up the language for unicode escape sequences in strings, and adds a conversion table to remove ambiguity from character escape sequences. Suggested by #214
@dylanahsmith and @chris-morgan I'd love your feedback on #231 |
This clears up the language for unicode escape sequences in strings, and adds a conversion table to remove ambiguity from character escape sequences. Suggested by graphql#214
👍 for this spec' ! To be able to build an enum like
|
@Nabellaleen Allowing emoji in an identifier is a completely different thing from allowing it in a source document, which is mostly for the sake of strings. And allowing emoji in identifiers is generally a poor idea; most languages stick with UAX #31’s definition for identifiers. |
I would be interested to revive this discussion: I don't see a reason for restricting it and we already see implementations and APIs having descriptions with emojis in it (e.g. github API). |
fyi: graphql-ruby supports all unicode chars (cc @rmosolgo) and we decided to do the same for GraphQL Java. |
Build fail if you have emoji in the path. |
I created a new issue which outlines proposed changes to the spec to allow for full unicode support: #687 |
Currently a GraphQL document is only allows a SourceCharacter ::
/[\u0009\u000A\u000D\u0020-\uFFFF]/
and EscapedUnicode ::/[0-9A-Fa-f]{4}/
also prevents unicode characters above U+FFFF from being included into a GraphQL string.Unicode code points are actually in the range 0 to 0x10FFFF. For example, unicode emoji characters like 😀 (U+1F600) have code points above U+FFFF.
Is there any reason why the source document doesn't allow unicode characters above U+FFFF? Or can we remove that restriction? Without that restriction the limitation of the unicode escape doesn't seem problematic.
If supporting a unicode escape for all unicode characters is desired, then one way of handling that is the way swift supports unicode escapes:
The text was updated successfully, but these errors were encountered: