 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Ray Guest
|
Posted: Thu Jan 19, 2006 10:27 pm Post subject: Need help with decoding URL |
|
|
I have an encoded string which I need to decode to present to the user.
The string is:
S1 = "php%253Fcmp";
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.
|
|
| Back to top |
|
 |
SMC Guest
|
Posted: Thu Jan 19, 2006 10:40 pm Post subject: Re: Need help with decoding URL |
|
|
On Fri, 20 Jan 2006 09:27:04 +1100, Ray wrote:
| Quote: | 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"
| Quote: | 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
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|