W3C home > Mailing lists > Public > public-xformsusers@w3.org > November 2016

JSON: characters below \u0020

From: Erik Bruchez <erik@bruchez.org>
Date: Tue, 29 Nov 2016 11:22:49 -0800
Message-ID: <CAAc0PEX2SvhhJdQT8tXvAYsFLAjVzKD2ES52+_H09kC9JtO0eg@mail.gmail.com>
To: "public-xformsusers@w3.org" <public-xformsusers@w3.org>
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

This archive was generated by hypermail 2.3.1 : Tuesday, 29 November 2016 19:23:45 UTC