mojombo/toml — pull request #173 by mojombo (2013-03-08 07:34:07+00:00)
Title: Use JSON compatible strings (removes \xXX syntax).

An implementation of ideas from #72 and #165. I agree that TOML strings should be the same as JSON strings (but enforce UTF-8).

--

ProTip™: You may notice that this specification is the same as JSON's string
definition, except that TOML requires UTF-8 encoding. This is on purpose.

Strings are single-line values surrounded by quotation marks. Strings must
contain only valid UTF-8 characters. Any Unicode character maybe be used except
those that must be escaped: quotation mark, backslash, and the control
characters (U+0000 to U+001F).

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

For convenience, some popular characters have a compact escape sequence.

```
\b - backspace (U+0008)
\t - tab (U+0009)
\n - newline (U+000A)
\f - form feed (U+000C)
\r - carriage return (U+000D)
\" - quote (U+0022)
\/ - slash (U+002F)
\\ - backslash (U+005C)
\uXXXX - unicode (U+XXXX)
```

Any Unicode character may be escaped with the `\uXXXX` form.

Other special characters are reserved and, if used, TOML should produce an
error. This means paths on Windows will always have to use double backslashes.

```toml
wrong = "C:\Users\nodejs\templates" # note: doesn't produce a valid path
right = "C:\\Users\\nodejs\\templates"
```

For binary data it is recommended that you use Base 64 or another suitable
encoding. The handling of that encoding will be application specific.