W3C home > Mailing lists > Public > uri@w3.org > January 2007

Re: URI and IRI Templating - encoding defaults

From: Mark Nottingham <mnot@mnot.net>
Date: Mon, 22 Jan 2007 09:34:59 +1100
Message-Id: <A11F8B07-80CE-4570-A14F-5F2626AE8D23@mnot.net>
Cc: Mike Schinkel <mikeschinkel@gmail.com>, <uri@w3.org>
To: Stefan Eissing <stefan.eissing@greenbytes.de>

I think pre-defining, but not mandating their use, would be helpful.

However, it's going to be tricky, because the form processor will  
have to figure out which rules to use based upon a) the URI scheme in  
use, and b) any "local" rules in place (in HTML4, this is supposed to  
be determined by the enctype attribute on the form).

It would be pretty easy to cover the common case (HTTP + application/ 
x-www-form-urlencoded), but getting interop on anything not covered  
would be more problematic. I guess it would have to fall back to the  
default -- nothing beyond non-URI characters -- but that's not a  
terribly satisfying answer. Some sort of encoding attribute on each  
variable declaration, e.g.,

<input type="text" name="foo" urlenc="query"/>

(using HTML4 forms as an example, I'm not familiar with the current  
state of 5) could work -- especially if the attribute's contents were  
extensible (e.g., with URIs).



On 2007/01/18, at 10:53 PM, Stefan Eissing wrote:

>
> Am 17.01.2007 um 23:40 schrieb Mark Nottingham:
>
>> Mike (and Stafan) have it right.
>>
>> Mike, it's basically saying that to figure out how to encoding  
>> things, you'll need to consider the way that the template is  
>> intended to be used -- so you'll need to follow its instructions.  
>> Considering that you'll already be doing so for other reasons  
>> (e.g., to figure out what to put in each variable, semantic-wise  
>> as well as for any variable-specific syntactic considerations),  
>> it's not too onerous.
>
> I was thinking of how Mike's webforms templates would work then:
>
> http://blog.whatwg.org/proposing-uri-templates-for-webforms-20
>
> Obviously the browser would have to escape some of the user input  
> when converting the template into a valid URI. Besides the uri  
> escaping of non-ascii chars, there are the special ones to  
> consider, like:
>
> http://example.com/{string}?test=123   // browser needs to escape  
> '?' in string
>
> http://example.com/abc?test={string}&xxx=123  // browser needs to  
> escape '&+'
>
> Question: is it worthwhile to define escaping rules for params that  
> are definitely part of a query (or precede a query). Or is this  
> something to be handled in a possible WebForms2.0 specification?
>
> Cheers,
>
> Stefan


--
Mark Nottingham     http://www.mnot.net/
Received on Sunday, 21 January 2007 22:34:52 UTC

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