Skip to content

Commit

Permalink
clarify that utf-8 is just a possible encoding of strings (#684)
Browse files Browse the repository at this point in the history
* clarify that utf-8 is just a possible encoding of strings

* fix Unicode spelling

* Update Section 3 -- Type System.md

* Update Section 3 -- Type System.md

Co-authored-by: Lee Byron <[email protected]>
  • Loading branch information
andimarek and leebyron authored Apr 16, 2021
1 parent d4777b4 commit 61c50f2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions spec/Section 3 -- Type System.md
Original file line number Diff line number Diff line change
Expand Up @@ -529,14 +529,16 @@ outside the available precision), a request error must be raised.

### String

The String scalar type represents textual data, represented as UTF-8 character
sequences. The String type is most often used by GraphQL to represent free-form
human-readable text. All response formats must support string representations,
and that representation must be used here.
The String scalar type represents textual data, represented as a sequence of
Unicode code points. The String type is most often used by GraphQL to
represent free-form human-readable text. How the String is encoded internally
(for example UTF-8) is left to the service implementation. All response
serialization formats must support a string representation (for example, JSON
Unicode strings), and that representation must be used to serialize this type.

**Result Coercion**

Fields returning the type {String} expect to encounter UTF-8 string internal values.
Fields returning the type {String} expect to encounter Unicode string values.

GraphQL services may coerce non-string raw values to {String} when reasonable
without losing information, otherwise they must raise a field error. Examples of
Expand All @@ -545,7 +547,7 @@ string `"1"` for the integer `1`.

**Input Coercion**

When expected as an input type, only valid UTF-8 string input values are
When expected as an input type, only valid Unicode string input values are
accepted. All other input values must raise a request error indicating an
incorrect type.

Expand Down

0 comments on commit 61c50f2

Please sign in to comment.