Re: URI template: %-escaping and ASCII templates

On Nov 3, 2009, at 5:46 AM, James Manger wrote:

> [Comments on the current URI Template working draft.]
> 
> 
> 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.

Yes, I added that to the draft last December (though forgot to Ack it).
It currently looks like

  variable-list =  varspec *( "," varspec )
  varspec       =  varname [ modifier ] [ "=" default ]
  varname       =  varchar *( varchar / "." )
  varchar       =  ALPHA / DIGIT / "_" / ucschar / iprivate
                /  pct-encoded

Thanks,

....Roy

Received on Friday, 26 February 2010 02:38:22 UTC