Re: Need help with decoding URL



On Fri, 20 Jan 2006 09:27:04 +1100, Ray wrote:

> I have an encoded string which I need to decode to present to the user.
> The string is:
>
> S1 = "php%253Fcmp";

This is encoded twice. The "%" character has been (correctly) encoded as
"%25"

> I want to display
>
> php?cmp
>
> to the user. I have tried creating a URI object from this class, then
> using getPath() from the object, but that gives me this output:
>
> php%3Fcmp
>
> I get the same output when I URLDecoder.decode to convert the string.
> How do I get the correct format? Thanks for any help.

You'd need to decode twice because of the above.

First run you'll get php%3Fcmp and 2nd run you'll get php?cmp


--
Sean

"It is one of the essential features of [incompetence] that the person
so afflicted is incapable of knowing that he is incompetent. To have
such knowledge would already be to remedy a good portion of the
offense." --W.I. Miller
.