W3C home > Mailing lists > Public > public-media-fragment@w3.org > November 2010

Re: ACTION-181 - escaping as defined by URI spec

From: Silvia Pfeiffer <silviapfeiffer1@gmail.com>
Date: Tue, 2 Nov 2010 12:52:53 +1100
Message-ID: <AANLkTi=3T4cEzsex7gWrsuHS_7-wf-yR4PWy24NU+mn1@mail.gmail.com>
To: Jack Jansen <Jack.Jansen@cwi.nl>
Cc: Media Fragment <public-media-fragment@w3.org>
On Tue, Nov 2, 2010 at 10:44 AM, Jack Jansen <Jack.Jansen@cwi.nl> wrote:
> Finally, I got around to finding out what the URI spec says about escaping.
> I've looked at rfc3986, that is still the most recent one, right?
>
> The interesting bits of knowledge, from our point of view, are the following.
>
> section 3.4, query:
>        query       = *( pchar / "/" / "?" )
> section 3.5, fragment:
>        fragment    = *( pchar / "/" / "?" )
> section 3.3:
>        pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"
> section 2.2, reserved characters, especially the second paragraph (right after the ABNF).
> section 2.4, when to encode and decode.
>
> The query and fragment section state that both of those consist of all the unreserved characters and "/?:@". Interestingly, you can have unescaped questionmarks in either, but the fragment cannot have an unescaped hash. The query section talks a bit about name=value, but nothing definitive.
>
> The really interesting bit, IMO, is the second paragraph of 2.2 (especially when compared to the same paragraph of section 2.3, unreserved characters. Here, it is explicitly stated that the interpretation of a subdelim and the percent-encoded representation of that character are not necessarily identical. In 2.3 it is stated that the interpretation of an unreserved character and its percent-encoded representation is identical.
>
> So, where the spec dictates that A and %41 are equivalent it states that = and %3d are different things. The spec says nothing about when to decode percent-escapes, except that you shouldn't do it before splitting the URL into its consituent parts (obviously). However, in my mind the referenced bits of sections 2.2 and 2.4 point towards doing percent-decoding as late as possible, in other words, if we put extra structure into the query and fragment parts we should use delims and subdelims there (as we already do) and do percent decoding after parsing our structure.
>
> So, what we do seems to be in line with the intention of rfc3986, but rfc3986 does not mandate that processing order. Therefore, I think we should state explicitly that percent-decoding is to happen after separation on & and = .


Makes sense to me.

Silvia.
Received on Tuesday, 2 November 2010 01:53:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 21 September 2011 12:13:40 GMT