- From: Joe Gregorio <joe@bitworking.org>
- Date: Tue, 26 Dec 2006 11:26:37 -0500
- To: "Mark Nottingham" <mnot@mnot.net>
- Cc: uri@w3.org
On 12/26/06, Mark Nottingham <mnot@mnot.net> wrote:
> Note the "or may not." The problem here is that there are many places
> that information about whether to encode can come from, and it's very
> difficult to come up with a generic rule that does the right thing
> *and* doesn't effectively profile URIs by taking options away.
One of the very first things I wrote in my analysis was:
"First let's dispel the notion that you can come up with
the perfect URI-Template to URI translation mechanism
that will always produce a valid URI regardless of the scheme. "
> I'd much rather either leave encoding up to the user*, and/or give
> them some tools that make it easy, but leave the choices in their hands.
Please see the example in my response to Jerome for why allowing
the client filling in the URI Template to decide how to encode the
template value is a non-starter.
On the other hand, allowing the template designer a choice in how the value
is encoded seems like an interesting idea. I worry, as usual, that
the results will be way too complex to be adopted, but let's turn it
into a concrete proposal and see how far it goes.
So, for example:
Allow a ':' at the end of a variable name to separate out options, and then
add an option 'enc=<enc>' where
'enc' could be:
enc="strict"
All characters outside (iprivate | iunreserved) are % encoded
enc="sub"
Characters outside (iprivate | iunreserved | sub-delims) are % encoded
enc="none"
No characters are % encoded
enc="default"
Or if '=<enc>' isn't provided then the default encoding is used:
Characters outside ( iprivate | iunreserved | '@' | ':' | '/' ) are
% encoded.
So back to the example, if we have:
http://bitworking.org/{path:enc=strict}
and
path = "projects/httplib2/"
then that gets interpreted as:
http://bitworking.org/projects%2Fhttplib2%2F
and
http://bitworking.org/{path:enc=default}
gets interpreted as:
http://bitworking.org/projects/httplib2/
Note that
http://bitworking.org/{path:enc=default}
and
http://bitworking.org/{path}
will give equivalent values.
Again, with this I worry about complexity and surprising behavior:
http://example.org?a={b:enc=strict}
b = "a=test"
gives:
http://example.org?a=a%3Dtest
while
http://example.org{b:enc=none}
b = "?a=test"
gives:
http://example.org?a=test
-joe
--
Joe Gregorio http://bitworking.org
Received on Tuesday, 26 December 2006 16:26:47 UTC