JSON: characters below \u0020

All,

Currently, the spec says:

    "characters and escapes that have no equivalent XML character (\b, \f,
and characters of the form \uxxxx less than \u0020) are transformed by
adding \uE000 to them."

The sentence contradict itself because in XML, the following characters
below \u0020 are supported:

- \u0009
- \u000A
- \u000D

So we should clarify this, and I suggest that we allow keeping the 3
characters above. Consider this piece of JSON:

    {
      "firstName": "John",
      "lastName": "Smith",
      "address": "1000 Main Street\nNew York, NY"
    }

The `\n` in "address" translates to a newline `\u000A`. If we translate it
to `\uE00A`, it becomes unnecessary inconvenient to handle the newline on
the XML side.

Conversely, when converting back from XML to JSON, a `\u000A` in the XML
must translate into `\n` in the resulting JSON.

For reference this was raised by a user. Details here:

    https://github.com/orbeon/orbeon-forms/issues/3012

Feedback welcome.

-Erik

Received on Tuesday, 29 November 2016 19:23:43 UTC