Re: [Json] Unpaired surrogates in JSON strings

Paul Hoffman <paul.hoffman@vpnc.org> Wed, 05 June 2013 18:01 UTC

Return-Path: <paul.hoffman@vpnc.org>
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 4D51221F9988 for <json@ietfa.amsl.com>; Wed, 5 Jun 2013 11:01:46 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -102.599
X-Spam-Level:
X-Spam-Status: No, score=-102.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, USER_IN_WHITELIST=-100]
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 bQn20lLXd6I5 for <json@ietfa.amsl.com>; Wed, 5 Jun 2013 11:01:45 -0700 (PDT)
Received: from hoffman.proper.com (IPv6.Hoffman.Proper.COM [IPv6:2605:8e00:100:41::81]) by ietfa.amsl.com (Postfix) with ESMTP id 2389921F9A15 for <json@ietf.org>; Wed, 5 Jun 2013 11:01:43 -0700 (PDT)
Received: from [10.20.30.90] (50-0-66-165.dsl.dynamic.sonic.net [50.0.66.165]) (authenticated bits=0) by hoffman.proper.com (8.14.5/8.14.5) with ESMTP id r55I1g2L089755 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for <json@ietf.org>; Wed, 5 Jun 2013 11:01:43 -0700 (MST) (envelope-from paul.hoffman@vpnc.org)
Content-Type: text/plain; charset="us-ascii"
Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\))
From: Paul Hoffman <paul.hoffman@vpnc.org>
In-Reply-To: <51AF7988.6040009@crockford.com>
Date: Wed, 05 Jun 2013 11:01:41 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <61407E6F-4178-471A-931C-D98E6F0C9756@vpnc.org>
References: <20130605162246.GG3680@mercury.ccil.org> <51AF7988.6040009@crockford.com>
To: "json@ietf.org" <json@ietf.org>
X-Mailer: Apple Mail (2.1508)
Subject: Re: [Json] Unpaired surrogates in JSON strings
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <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: Wed, 05 Jun 2013 18:01:46 -0000

<definitely no hat>

On Jun 5, 2013, at 10:46 AM, Douglas Crockford <douglas@crockford.com> wrote:

> On 6/5/2013 9:22 AM, John Cowan wrote:
>> RFC 4627 Section 1 says:
>> 
>>     A string is a sequence of zero or more Unicode characters.
>> 
>> However, the grammar of strings permits things like "foo\uDC00bar",
>> which contains an escape sequence that does not correspond to any
>> Unicode character.  This provides backward compatibility with JavaScript,
>> where a string is not a sequence of characters but a sequence of UTF-16
>> code units.
>> 
>> If Section 1 is normative, then there is a contradiction with Section 4,
>> which says:
>> 
>>     A JSON parser MUST accept all texts that conform to the JSON
>>     grammar.
>> 
>> In my view, JSONbis processors should be REQUIRED to produce only strings
>> that conform to Section 1.
>> 
> Such a requirement will be breaking. Breaking changes are out of scope.

How is that "breaking"? Section 1 has a definition of strings, and Section 4 says that the parser must accept all texts that conform to the grammar. Surrogate code points are not characters, according to the Unicode spec.

> I like the suggestion that section 1 should be talking about code points instead of characters.

That seems like a significant change that would cause parsers that currently follow Section 1 to fail.

--Paul Hoffman