Solved

Getting the parameter value exactly the same in Java

Posted on 2007-04-04
5
216 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
  • 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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
java. non-English characters encoding problem. intellij idea 3 73
base64 decode encode 12 119
eclipse formatting 6 68
java stored proc example 9 17
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

947 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now