This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Java encryption of String to alphanumeric values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java encryption of String to alphanumeric values" Watch "Java encryption of String to alphanumeric values" New topic
Author

Java encryption of String to alphanumeric values

Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 349

Hi Ranchers,

How do I encrypt a String which is URL compliant. All my trials gives encrypted values with characters like "+" and "\". I could not get the exact values through get parameter values. So when I tried to decrypt I do not get the expected results.


Any sample code or suggestion would be greatly appreciated.

Ananth Chellathurai [Walk on software]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41091
    
  44
That's what URL-encoding does. Check out the java.net.URLEncoder and URLDecoder classes.


Ping & DNS - my free Android networking tools app
Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 349

Thanks ulf,

org.apache.commons.httpclient.util.URIUtil also can fulfill the same requirements.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41091
    
  44
Why would you use a 3rd party library if a built-in JRE class can do it?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Java encryption of String to alphanumeric values
 
Similar Threads
How to convert ArrayList to String Array in java
Exception executing servlet with database connectivity
Help...StringTokenizer
Help....StringTokenizer
Enumeration is not returning any data