You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This spec text implements #687 (full context and details there) and also introduces a new escape sequence.
Three distinct changes:
1. Change SourceCharacter to allow points above 0xFFFF, now to 0x10FFFF.
2. Allow surrogate pairs within StringValue. This handles illegal pairs with a parse error.
3. Introduce new syntax for full range code point EscapedUnicode. This syntax (`\u{1F37A}`) has been adopted by many other languages and I propose GraphQL adopt it as well.
(As a bonus, this removes the last instance of a regex in the lexer grammar!)
EscapedCharacter :: one of `"``\``/``b``f``n``r``t`
821
828
@@ -899,16 +906,30 @@ StringValue :: `""`
899
906
900
907
StringValue :: `"` StringCharacter+ `"`
901
908
902
-
* Return the sequence of all {StringCharacter} code points.
909
+
* Let {string} be the sequence of all {StringCharacter} code points.
910
+
* For each {codePoint} at {index} in {string}:
911
+
* If {codePoint} is >= 0xD800 and <= 0xDBFF (a [*High Surrogate*](https://unicodebook.readthedocs.io/unicode_encodings.html#utf-16-surrogate-pairs)):
912
+
* Let {lowPoint} be the code point at {index} + {1} in {string}.
913
+
* Assert {lowPoint} is >= 0xDC00 and <= 0xDFFF (a [*Low Surrogate*](https://unicodebook.readthedocs.io/unicode_encodings.html#utf-16-surrogate-pairs)).
* Within {string}, replace {codePoint} and {lowPoint} with {decodedPoint}.
916
+
* Otherwise, assert {codePoint} is not >= 0xDC00 and <= 0xDFFF (a [*Low Surrogate*](https://unicodebook.readthedocs.io/unicode_encodings.html#utf-16-surrogate-pairs)).
917
+
* Return {string}.
918
+
919
+
Note: {StringValue} should avoid encoding code points as surrogate pairs.
920
+
While services must interpret them accordingly, a braced escape (for example
921
+
`"\u{1F4A9}"`) is a clearer way to encode code points outside of the
0 commit comments