Re: [apps-discuss] Confusing JSON Pointer

지송원 James Songwon Chi <chi880466@gmail.com> Tue, 27 March 2012 13:49 UTC

Return-Path: <chi880466@gmail.com>
X-Original-To: apps-discuss@ietfa.amsl.com
Delivered-To: apps-discuss@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D71C821E81D1 for <apps-discuss@ietfa.amsl.com>; Tue, 27 Mar 2012 06:49:14 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 1.403
X-Spam-Level: *
X-Spam-Status: No, score=1.403 tagged_above=-999 required=5 tests=[AWL=-0.948, BAYES_00=-2.599, CHARSET_FARAWAY_HEADER=3.2, MIME_8BIT_HEADER=0.3, MIME_CHARSET_FARAWAY=2.45, RCVD_IN_DNSWL_LOW=-1]
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 9VNsC9sctRvF for <apps-discuss@ietfa.amsl.com>; Tue, 27 Mar 2012 06:49:13 -0700 (PDT)
Received: from mail-vb0-f44.google.com (mail-vb0-f44.google.com [209.85.212.44]) by ietfa.amsl.com (Postfix) with ESMTP id BA0EE21E81D9 for <apps-discuss@ietf.org>; Tue, 27 Mar 2012 06:49:13 -0700 (PDT)
Received: by vbbez10 with SMTP id ez10so3907936vbb.31 for <apps-discuss@ietf.org>; Tue, 27 Mar 2012 06:49:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=q0owiNEmUC2HNUB3+oMrlwKZteeyJ9BtWRYb4oIKZD8=; b=h+TvNzveFpwOKUHlkX/Z1k2aktElfISA4wSsOWgsXH0UqNBVnnw9xLJ+H2Zh3WR67h W0ssMpMTg9ReINIZtlt5l7TcXyuSqAdufhB0+GtyL0t2WJ5PBTks9YSWFBFfwaKSj1Zp BiDKuqpxVF0Pt7xQ+MxTdOfvdaODiW7pqmhhaobiwEsFGKQLhGSGmmV8Y7SlCt9ciFE+ Jh79l1NcvWEUgzyl5L0fpCiGko933CfDVRrdZoHF4q7/MIIrJUfoVB578syzmxxFh65n yfSfAtq0xVUocXZZrSd7PWU4zTkNEgANk4I7R67BseFkonBMRJZ+crL/FldYjG4SEa6u SknA==
MIME-Version: 1.0
Received: by 10.52.19.196 with SMTP id h4mr9997576vde.91.1332856152983; Tue, 27 Mar 2012 06:49:12 -0700 (PDT)
Received: by 10.220.1.4 with HTTP; Tue, 27 Mar 2012 06:49:12 -0700 (PDT)
In-Reply-To: <4F7172FE.6060207@gmx.de>
References: <CAJO=ius8siusDXemCFQKy9=HOXs6L9eX108u7-OW3Rvu+L9qDw@mail.gmail.com> <4F7172FE.6060207@gmx.de>
Date: Tue, 27 Mar 2012 22:49:12 +0900
Message-ID: <CAJO=iuv2b1J8D=k5mTEYU3f564cYnXuiL=-83qKFm-kGAjSZOw@mail.gmail.com>
From: 지송원 James Songwon Chi <chi880466@gmail.com>
To: Julian Reschke <julian.reschke@gmx.de>
Content-Type: text/plain; charset="EUC-KR"
Content-Transfer-Encoding: quoted-printable
Cc: apps-discuss@ietf.org
Subject: Re: [apps-discuss] Confusing JSON Pointer
X-BeenThere: apps-discuss@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: General discussion of application-layer protocols <apps-discuss.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/apps-discuss>
List-Post: <mailto:apps-discuss@ietf.org>
List-Help: <mailto:apps-discuss-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 27 Mar 2012 13:49:15 -0000

2012년 3월 27일 오후 4:57, Julian Reschke <julian.reschke@gmx.de>님의 말:
> On 2012-03-27 07:22, 지송원 James Songwon Chi wrote:
>>
>> After reading JSON Pointer (draft-ietf-appsawg-json-pointer-01), I am
>> confused with encoding or escape scheme.
>> For me, it is an ambiguous scheme. For example, a reference token
>> "ref/1" can be expressed following ways:
>>
>> 1) If it is a URI fragment identifier and a JSON Pointer
>>      Step 1. apply URI encoding: ref%5C1
>>      Step 2. apply JSON Pointer encoding:  ref%5C1
>>      Final result: ref%5C1
>>
>> 2) If it is a JSON Pointer and a URI fragment identifier
>>      Step 1. apply JSON Pointer encoding: ref^/1
>>      Step 2. apply URI encoding:  ref^%5C1
>>      Final result: ref^%5C1
>>
>> I expected the same results.
>>
>> And if my interpretation is wrong, to prevent the similar question,
>> there should be some examples for this kind.
>> ...
>
>
> I don't understand the question.
>
> The spec states how to put JSON Pointers (^-escaping) into fragment
> identifiers (%-escaping).
>
> As far as I can tell the outcome then is what you have under 2), no?
>
> Best regards, Julian

Thank you Julian for the reply.
Yes. Answer is 2) for above question. Well, but I gave a wrong
question and a wrong example (And solidus is 0x2F, not 0x5C.)

This is corrected one:

If I want a JSON Pointer to be represented as both a JSON String and a
URI fragment identifier, I should apply three encoding scheme.
There are two sequences with example:

1) step 1. JSON Pointer escape:  ref^/1
    step 2. JSON String escape:    ref^\/1
    step 3. URI encoding:              ref^\%2F1

2) step 1. JSON Pointer escape: ref^/1
    step 2. URI encoding:              ref^%2F1
    step 3. JSON String escape:    ref^%2F1

The results are same except  only when there is a solidus and it is
encoded as '\/' during JSON String encoding.
As in the example, ref^/1 becomes either ref^\%2F1  or  ref^%2F1 ( differs '\').

Note that JSON String allows multiple encodings for a character.  For
a soldus(/) there are four possible encodings -  '/', '\/', '\u002F',
and '\u002f'.  Also URI encoding allows multiple encodings in case of
percentage encoding - %2F and %2f.


Any comment?

James