File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes decode the string server side which is received from the client side Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "decode the string server side which is received from the client side" Watch "decode the string server side which is received from the client side" New topic
Author

decode the string server side which is received from the client side

Vas Miriyala
Ranch Hand

Joined: Sep 14, 2009
Posts: 114

Hi all,
I have used escape function in javascript to encode the user entered text and sending
this encoded string to the server side,Now i want to decode this encoded string in Server side to do the persistance operations.
any idea on this how can we do?
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1106

look into the java class URLEncoder
Vas Miriyala
Ranch Hand

Joined: Sep 14, 2009
Posts: 114

Hi all
I solved the problem by using java.net.URLDecoder.decode("stringName","UTF-8"); in servlets
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60048
    
  65

Why did you encode the string in the first place?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1106

Bear Bibeault wrote:Why did you encode the string in the first place?


isn't it sensible to do that for user entered text, just in case they do something crazy?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60048
    
  65

Wendy Gibbons wrote:
Bear Bibeault wrote:Why did you encode the string in the first place?


isn't it sensible to do that for user entered text, just in case they do something crazy?


Such as?

The text is going to be encoded automatically for delivery to the server, and automatically decoded. Why doubly-encode it, necessitating decoding on the server? It's just an extra step that does absolutely nothing constructive.
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1106

Bear Bibeault wrote:
Wendy Gibbons wrote:
Bear Bibeault wrote:Why did you encode the string in the first place?


isn't it sensible to do that for user entered text, just in case they do something crazy?


Such as?

The text is going to be encoded automatically for delivery to the server, and automatically decoded. Why doubly-encode it, necessitating decoding on the server? It's just an extra step that does absolutely nothing constructive.


oh ok
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: decode the string server side which is received from the client side
 
Similar Threads
August Newsletter Puzzle
about URLEncoding
URLEncoder & URLDecoder
XML Escape Newline Characters
How to pass characters like+ as parameter in the URL