hc-dev mailing list archives

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

I'm having a weird problem with escaped characters in the query part of 
a URI.  In the old, alpha1 version of HttpClient, we used 
URIUtil.encodeAll() to encode our query parameter values, and it escaped 
spaces with "+", resulting in "Mountain+View". With the latest 
HttpClient, we use URIUtil.encodeWithinQuery().  If we encode a query 
like "Mountain View", we get back "Mountain%20View". 

Does anyone know why this behavior changed?  Our app server is barfing 
on it for some reason and giving the JSP the encoded string with the %20 
in it when it calls getParameter.  (This is probably a bug in the 
server, but our applications group is on my case because the behavior of 
our client changed.)

The background ere is that for legacy reasons, we build up the query 
part of the URL ourselves, encoding each parameter as we append it to 
the string.  Then we create a java.net.URL object out of it (yuck).  
Finally, at fetch time, we do new URI(url.toString()).  (Double yuck.)

I'm going to play with this a bit more.  It may be that I don't even 
have to encode the query strings myself, and that the new URI 
constructor will do it for me.  But I figured I'd ask here and see if 
anyone knew what had changed or had run into a problem like this before.

Laura Werner
BeVocal


Mime
View raw message