0

I have html file and it has some labels.when i usually get the values through request parameters appended to URL. when i display the values in an html they will be dispalyed with ASCII chars as below. am getting values with %20 from my URL itself. And am reading them in servlet and forward to some.jsp

Name=Hellow%20how%20are%20you

But i want out put as:

Name=Hello how are you

Do i need to do anything in my html to render the value without ASCII ?

Thanks!

Charaf JRA
  • 8,249
  • 1
  • 34
  • 44
user755806
  • 6,565
  • 27
  • 106
  • 153

3 Answers3

0

Use unescape():

Name = unescape("Hellow%20how%20are%20you"); // = "Hellow how are you"

Example fiddle

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
0

I see that you have servlet here , so you talk about java not javascript i guess.

Any way In java you got StringEscapeUtils from Commons Lang to escape/unescape.

In Javascript you escape through encodeURIComponent, but I think the Commons component I gave to you will satisfy your needs.

Charaf JRA
  • 8,249
  • 1
  • 34
  • 44
0

I solved it by putting :

URLDecoder.decode(request.getQueryString(), "UTF-8"); 
user755806
  • 6,565
  • 27
  • 106
  • 153
  • it's good that you have solved your problem and posted an answer but it would have been much nicer if you have explained how you got the above code so others can understand –  Sep 17 '13 at 11:06