Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

decoding URL values

 
Suresh Khant
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a servlet which receives data

for example :

I have the following questions
Q1 : Is it possible to save the received data as it is , for above example , i want to data save as in database

Q2 : How to decode above Data to its original string ?

[Edit by Bear: added more descriptive subject]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64975
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suresh Khant wrote:
Q1 : Is it possible to save the received data as it is , for above example , i want to data save as in database

Why? That doesn't seem like a reasonable thing to do.

In any case, the value will be automatically decoded by getParameter(). You can re-encode it, if you wish, with java.net.URLEncoder.

Q2 : How to decode above Data to its original string ?

As I said, this will happened automatically.

In general, to decode use java.net.URLDecoder.
 
Suresh Khant
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply,

I have used the UrlDecoder



but getting squares




 
Paul Clapham
Sheriff
Posts: 21139
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, of course you are. What did you expect to get from %06?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic