W3C home > Mailing lists > Public > uri@w3.org > February 2010

FW: URI template: %-escaping and ASCII templates

From: Eran Hammer-Lahav <eran@hueniverse.com>
Date: Thu, 25 Feb 2010 18:45:53 -0700
To: "uri@w3.org" <uri@w3.org>, "Roy T. Fielding (fielding@gbiv.com)" <fielding@gbiv.com>
Message-ID: <90C41DD21FB7C64BB94121FBBC2E723438D923ADBC@P3PW5EX1MB01.EX1.SECURESERVER.NET>
Also, I tend to agree with James' feedback below which I think should be incorporated.

EHL

From: uri-request@w3.org [mailto:uri-request@w3.org] On Behalf Of James Manger
Sent: Tuesday, November 03, 2009 5:46 AM
To: uri@w3.org
Subject: URI template: %-escaping and ASCII templates

[Comments on the current URI Template working draft<http://code.google.com/p/uri-templates/source/browse/trunk/spec/draft-gregorio-uritemplate.xml>.]


1. It would be helpful if URI Templates (like URIs) can be written in ASCII so they can be used in similar places to URIs (eg a Link-Template: <template>... HTTP header, similar to the Link: <uri>... HTTP header).
2. Templates should support (almost) all of unicode for variable names.

The current draft offers #2, but not #1. I think we can have both.

The current draft is really an "IRI Template" as 'literals' in a template can use almost any Unicode characters and 'pct-encoded' sequences. Variable names can use almost any Unicode characters -- but NOT 'pct-encoded' sequences.

Consequently, while an IRI can be converted to an ASCII URI (and still be a valid IRI), a template cannot be converted to an ASCII form.

I suggest allowing 'pct-encoded' sequences in 'varname'. These would be decoded before using the resultant variable name to lookup the variable value.
The 'vartype' used to indicate when the variable is an associative array would have to be changed from '%' to another special character.

The definitions become:
  varspec  = [ vartype ] varname [ modifier ] [ "=" default ]
  vartype  = "@" / something other than "%"
  varname = 1*( varchar / pct-encoded )
  varchar = ALPHA / DIGIT / "." / "_" / ucschar / iprivate

Then if you need to put a URI Template into an ASCII protocol, you can %-escape any non-ASCII chars in literals and variable names -- it will still be a valid URI Template.


P.S. I would avoid using '%' for anything other than %-escapes to minimise potential human confusion -- even if it is technically unambiguous.


James Manger
Received on Friday, 26 February 2010 01:46:39 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:25:14 UTC