?
Solved

Getting the parameter value exactly the same in Java

Posted on 2007-04-04
5
Medium Priority
?
225 Views
Last Modified: 2010-03-31
Hi All,

    I am passing querys as a  parameter in the url. But when I am getting that query back in another java class, I am having some problems like + is replaced with space and % is replaced with some special character etc. So my question is how should I get the query as it is without ant thing changed.

Thanks
MTREDDY
0
Comment
Question by:manyam537
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 18850680
Either use URLEncoder or URLDecoder
0
 

Author Comment

by:manyam537
ID: 18850839
Hi CEHZ,

     You mean I can use URLEncode.encode before sending it as an url parameter or after getting the parameter i have to use URLDecoder.decode. Is it right? What are the encodings or decodings I can use.

The method has encode(String parameter, String encodingUsed)

So what should I use for second parameter.

Thanks
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 1500 total points
ID: 18850856
That's right. I would use "UTF-8" for the second parameter to the method
0
 

Author Comment

by:manyam537
ID: 18850951
Hi CEHZ,

   Thanx for responding fast.

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 18850959
:-)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses
Course of the Month12 days, 14 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question