hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laura Werner <la...@lwerner.org>
Subject Re: URI query escapes
Date Fri, 20 Jun 2003 20:48:02 GMT
Hi Michael,

I wish I'd done a bit more digging before my original post.  It turns 
out the problem is that parameters were being encoded *twice*.  We were 
encoding them once on our own, then the URI constructor was encoding 
them again.  My "Mountain View" example was being encoded as 
"Mountain%2520View".  If we encode them only once (even with %20 rather 
than +) everything works. 

 >... are we correctly handling query params by URI encoding them?

Probably not.  HTTP 4.01 
<http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1> says:

> application/x-www-form-urlencoded
>
> This is the default content type. Forms submitted with this content 
> type must be encoded as follows:
>
>    1. Control names and values are escaped. Space characters are
>       replaced by `+', and then reserved characters are escaped as
>       described in [RFC1738]
>       <http://www.w3.org/TR/html4/references.html#ref-RFC1738>,
>       section 2.2: Non-alphanumeric characters are replaced by `%HH',
>       a percent sign and two hexadecimal digits representing the ASCII
>       code of the character. Line breaks are represented as "CR LF"
>       pairs (i.e., `%0D%0A').
>
Section 4 says "must" means MUST in the rfc2119 sense, so I think we 
have to do URL encoding rather than URI encoding for the query 
parameters.  A quick replacement of ' ' with '+' followed by the usual 
URI encoding might do it.

-- Laura


Mime
View raw message