AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need help with decoding URL

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
Ray
Guest





PostPosted: Thu Jan 19, 2006 10:27 pm    Post subject: Need help with decoding URL Reply with quote



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





PostPosted: Thu Jan 19, 2006 10:40 pm    Post subject: Re: Need help with decoding URL Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.