},
{
// String options that have a comma in their values need to have
- // it escaped (i.e. each comma is predeced by a backslash). That's
+ // it escaped (i.e. each comma is predeced by two backslashes). That's
// because commas are reserved for separating fields in compound
- // options.
+ // options. At the same time, we need to be conformant with JSON spec,
+ // that does not allow "\,". Therefore the slightly uncommon double
+ // backslashes natation is needed.
"name": "boot-file-name",
- "data": "EST5EDT4\,M3.2.0/02:00\,M11.1.0/02:00"
+ "data": "EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00"
}
]
}
},
{
// String options that have a comma in their values need to have
- // it escaped (i.e. each comma is predeced by a backslash). That's
+ // it escaped (i.e. each comma is predeced by two backslashes). That's
// because commas are reserved for separating fields in compound
- // options.
+ // options. At the same time, we need to be conformant with JSON spec,
+ // that does not allow "\,". Therefore the slightly uncommon double
+ // backslashes natation is needed.
"name": "new-posix-timezone",
"data": "EST5EDT4\,M3.2.0/02:00\,M11.1.0/02:00"
}
</para>
<para>When the data field is a string, and that string contains the comma
- (,; U+002C) character, the comma must be escaped with a reverse solidus
- character (\; U+005C). For example, the string
+ (,; U+002C) character, the comma must be escaped with a double reverse solidus
+ character (\; U+005C). This double escape is required, because a
+ single escape (\,) would make the JSON invalid. For example, the string
"foo,bar" would be represented as:
<screen>
"Dhcp4": {
<userinput>"option-data": [
{
"name": "boot-file-name",
- "data": "foo\,bar"
+ "data": "foo\\,bar"
}
]</userinput>
},
which was not assigned by IANA) are listed in
<xref linkend="dhcp6-exp-options-list"/>.
</para>
- <para>When the data field is a string, and that string contains the comma
- (,; U+002C) character, the comma must be escaped with a reverse solidus
- character (\; U+005C). For example, the string "EST5EDT4,M3.2.0/02:00,M11.1.0/02:00" would be
+ <para>When the data field is a string, and that string contains
+ the comma (,; U+002C) character, the comma must be escaped with a
+ reverse solidus character (\; U+005C). This double escape is
+ required, because a single escape (\,) would make the JSON
+ invalid. For example, the string
+ "EST5EDT4,M3.2.0/02:00,M11.1.0/02:00" would be
represented as:
<screen>
"Dhcp6": {