Skip to content

Conversation

@jwaldrip
Copy link
Contributor

Summary

Test plan

  • Added comprehensive Unicode tests (64 new tests)
  • All 1506 tests pass
  • Variable-width escapes work correctly
  • Surrogate pairs properly combined
  • Invalid Unicode scalar values rejected with appropriate errors

🤖 Generated with Claude Code

This implements Full Unicode Support as defined in GraphQL specification
September 2025 (RFCs absinthe-graphql#805, absinthe-graphql#1040, absinthe-graphql#1053, absinthe-graphql#1142).

Changes:
- Add support for variable-width Unicode escape sequences (\u{XXXXXX})
  allowing representation of all Unicode scalar values up to U+10FFFF
- Add validation for Unicode scalar values in escape sequences
- Add support for surrogate pair decoding in fixed-width escapes (\uXXXX)
  for legacy compatibility with supplementary plane characters
- Properly reject invalid escape sequences:
  - Lone high surrogates (U+D800-U+DBFF)
  - Lone low surrogates (U+DC00-U+DFFF)
  - Out of range values (>U+10FFFF)
  - Surrogates in variable-width escapes
- Update Parse phase to handle new Unicode escape error type
- Add comprehensive test suite covering:
  - Basic Unicode in strings
  - BMP escape sequences (\uXXXX)
  - Extended escape sequences (\u{XXXXXX})
  - Surrogate pair handling
  - Emoji and supplementary plane characters
  - Invalid escape rejection
  - Block strings with Unicode
  - Edge cases

The implementation maintains full backward compatibility with existing
GraphQL documents while enabling the new Unicode features.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@jwaldrip
Copy link
Contributor Author

jwaldrip commented Feb 6, 2026

Checking in — any feedback on the Unicode support changes? This aligns Absinthe with the September 2025 spec. Let me know if there are any concerns.

@jwaldrip jwaldrip marked this pull request as ready for review February 6, 2026 18:44
Copy link
Contributor

@bryanjos bryanjos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. I just had a question about 2 of the tests

Comment on lines +47 to +59
test "parses Japanese characters" do
assert {:ok, [{:string_value, {1, 1}, value}]} =
Lexer.tokenize(~s(""))

assert to_string(value) == ~s("")
end

test "parses Arabic characters" do
assert {:ok, [{:string_value, {1, 1}, value}]} =
Lexer.tokenize(~s(""))

assert to_string(value) == ~s("")
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these 2 tests be updated or removed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants