Skip to content
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

Add \xHH Unicode escape code to basic strings #796

Merged
merged 4 commits into from
Jul 30, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* Clarify where and how dotted keys define tables.
* Add new `\e` shorthand for the escape character.
* Add \x00 notation to basic strings.

## 1.0.0 / 2021-01-11

Expand All @@ -20,7 +21,8 @@

## 1.0.0-rc.2 / 2020-08-09

* Create https://toml.io as the new primary location to read the TOML spec.
* Create [https://toml.io](https://toml.io) as the new primary location to read
the TOML spec.
eksortso marked this conversation as resolved.
Show resolved Hide resolved
* Clarify meaning of "quotation marks".
* Clarify meaning of "expected" value ranges.
* Clarify that EOF is allowed after key/value pair.
Expand Down
5 changes: 3 additions & 2 deletions toml.abnf
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ escape-seq-char =/ %x66 ; f form feed U+000C
escape-seq-char =/ %x6E ; n line feed U+000A
escape-seq-char =/ %x72 ; r carriage return U+000D
escape-seq-char =/ %x74 ; t tab U+0009
escape-seq-char =/ %x75 4HEXDIG ; uXXXX U+XXXX
escape-seq-char =/ %x55 8HEXDIG ; UXXXXXXXX U+XXXXXXXX
escape-seq-char =/ %x78 2HEXDIG ; xHH U+00HH
escape-seq-char =/ %x75 4HEXDIG ; uHHHH U+HHHH
escape-seq-char =/ %x55 8HEXDIG ; UHHHHHHHH U+HHHHHHHH

;; Multiline Basic String

Expand Down
11 changes: 6 additions & 5 deletions toml.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ the control characters other than tab (U+0000 to U+0008, U+000A to U+001F,
U+007F).

```toml
str = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF."
str = "I'm a string. \"You can quote me\". Name\tJos\xE9\nLocation\tSF."
```

For convenience, some popular characters have a compact escape sequence.
Expand All @@ -281,12 +281,13 @@ For convenience, some popular characters have a compact escape sequence.
\e - escape (U+001B)
\" - quote (U+0022)
\\ - backslash (U+005C)
\uXXXX - unicode (U+XXXX)
\UXXXXXXXX - unicode (U+XXXXXXXX)
\xHH - unicode (U+00HH)
\uHHHH - unicode (U+HHHH)
\UHHHHHHHH - unicode (U+HHHHHHHH)
```

Any Unicode character may be escaped with the `\uXXXX` or `\UXXXXXXXX` forms.
The escape codes must be valid Unicode [scalar
Any Unicode character may be escaped with the `\xHH`, `\uHHHH`, or `\UHHHHHHHH`
forms. The escape codes must be valid Unicode [scalar
values](https://unicode.org/glossary/#unicode_scalar_value).

All other escape sequences not listed above are reserved; if they are used, TOML
Expand Down