• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 114
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
look into the java class URLEncoder
 
Vas Miriyala
Ranch Hand
Posts: 114
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all
I solved the problem by using java.net.URLDecoder.decode("stringName","UTF-8"); in servlets
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why did you encode the string in the first place?
 
Wendy L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic