hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Voss <i...@petervoss.org>
Subject Re: Best way to unescape encoded URLs
Date Mon, 12 Jan 2009 11:09:01 GMT
Hi Bill,

you could use java.net.URLDecoder. First extract the part of your  
string that has to be decoded. Then call:
URLDecoder.decode(encodedString, "UTF-8");

e.g.
URLDecoder.decode("http%3A%2F%2Fwww.google.com%2F", "UTF-8")
will return
http://www.google.com/

--Peter

On 12.01.2009, at 06:03, Bill Higgins wrote:

> I realize that this is not strictly an HttpComponents question but
> Googling around it looks like Oleg has felt the pain of this area of
> Java. :-)
>
> I have a little proxy handler that gets URLs like this:
>
>    http://localhost:8080/_proxy/http%3A%2F%2Fwww.google.com%2F
>
> What's the simplest / sanest way to decode the encoded URI after
> /_proxy/ (in this case http%3A%2F%2Fwww.google.com%2F) in Java?
>
> --
>
> - Bill
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message