diff --git a/CHANGELOG.md b/CHANGELOG.md index 44d95302..1e3c4077 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Allow trailing comma in inline tables. * 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 diff --git a/toml.abnf b/toml.abnf index 62771983..3d926ee7 100644 --- a/toml.abnf +++ b/toml.abnf @@ -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 diff --git a/toml.md b/toml.md index 7a0b0d73..58232cd9 100644 --- a/toml.md +++ b/toml.md @@ -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. @@ -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