[Json] ECMAScript v6 adds new escape sequence: \u{x…}

"Manger, James H" <James.H.Manger@team.telstra.com> Tue, 12 March 2013 05:11 UTC

Return-Path: <James.H.Manger@team.telstra.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id DDEE021F860A for <json@ietfa.amsl.com>; Mon, 11 Mar 2013 22:11:54 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.07
X-Spam-Level:
X-Spam-Status: No, score=0.07 tagged_above=-999 required=5 tests=[AWL=-0.970, BAYES_05=-1.11, HELO_EQ_AU=0.377, HOST_EQ_AU=0.327, MIME_8BIT_HEADER=0.3, RELAY_IS_203=0.994, SARE_SUB_ENC_UTF8=0.152]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lyewSRCQxk58 for <json@ietfa.amsl.com>; Mon, 11 Mar 2013 22:11:53 -0700 (PDT)
Received: from ipxcno.tcif.telstra.com.au (ipxcno.tcif.telstra.com.au [203.35.82.208]) by ietfa.amsl.com (Postfix) with ESMTP id 65ACD21F8600 for <json@ietf.org>; Mon, 11 Mar 2013 22:11:53 -0700 (PDT)
X-IronPort-AV: E=Sophos;i="4.84,827,1355058000"; d="scan'208";a="119139074"
Received: from unknown (HELO ipccni.tcif.telstra.com.au) ([10.97.216.208]) by ipocni.tcif.telstra.com.au with ESMTP; 12 Mar 2013 16:11:52 +1100
X-IronPort-AV: E=McAfee;i="5400,1158,7011"; a="120401932"
Received: from wsmsg3752.srv.dir.telstra.com ([172.49.40.173]) by ipccni.tcif.telstra.com.au with ESMTP; 12 Mar 2013 16:11:52 +1100
Received: from WSMSG3153V.srv.dir.telstra.com ([172.49.40.159]) by WSMSG3752.srv.dir.telstra.com ([172.49.40.173]) with mapi; Tue, 12 Mar 2013 16:11:52 +1100
From: "Manger, James H" <James.H.Manger@team.telstra.com>
To: "json@ietf.org" <json@ietf.org>
Date: Tue, 12 Mar 2013 16:11:51 +1100
Thread-Topic: =?utf-8?B?RUNNQVNjcmlwdCB2NiBhZGRzIG5ldyBlc2NhcGUgc2VxdWVuY2U6IFx1e3g=?= =?utf-8?B?4oCmfQ==?=
Thread-Index: Ac4e4BraRLQzlIcsSOKMaqYGtI9Ndg==
Message-ID: <255B9BB34FB7D647A506DC292726F6E1150B786AB1@WSMSG3153V.srv.dir.telstra.com>
Accept-Language: en-US, en-AU
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
acceptlanguage: en-US, en-AU
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
Subject: [Json] =?utf-8?q?ECMAScript_v6_adds_new_escape_sequence=3A_=5Cu?= =?utf-8?b?e3jigKZ9?=
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "Discussion related to JavaScript Object Notation \(JSON\)." <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/json>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 12 Mar 2013 05:11:55 -0000

One change to JSON in ECMAScript v6 from RFC 4627 (and from ECMAScript v5) appears to be a new way of writing a Unicode escape.

In RFC 4627, a Unicode escape is \uxxxx (where x is a hex digit).
In an ECMAScript 6th edition draft (2012-11-22), a Unicode escape can be \uxxxx, or \u{x...}.
Hence, "\n" = "\u000A" = "\u{A}".

See UnicodeEscapeSequence at http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.4.

Maybe.

This ECMAScript edition 6 draft actually defines UnicodeEscapeSequence twice: once in section 7.8.4 with \uxxxx and \u{x...}; and also in Annex A.1 "Lexical Grammar" with only \uxxxx. My guess is that the former is right and the latter just hasn't been updated yet.

\u{x...} is nicer for Unicode code points over 0xFFFF, but I doubt it is worth introducing at this point.

Anyway, one more item for RFC4627bis to consider.

--
James Manger