strange behaviour of Descriptor
| Wed, 2007-09-12 08:18 | |
|
Hi to all, I am trying to send a string value from my application to java servlet using HTTP api but when i recieve this on servlet side it becomes "sulabh%2304" Please tell me what is wrong with this Thanks in Advance |
|






Forum posts: 1233
I don't think there is anything really "wrong" with it.
Part of the HTTP standard or URL standard or whatever (I'm no web guy) says you translate "special" characters to that %-form.
Your servlet should be able to handle it and translate it back.
Forum posts: 73
why this only tanslate the special character any method to prevent this from encoding
thanks
Forum posts: 1242
You probably can't prevent this from happening, as it is indeed a requirement of the relevant Internet standards that special characters like # are encoded as %23.
I think you have 2 choices: Prevent this from happening by simply not using such characters for the strings that you send (difficult, maybe impossible), or decode the strings on the server side (probably trivial, maybe done with just one method call).
René Brunner
Forum posts: 73
Thanks to all of you
I can't leave such character, Please tell me how can i decode this string on server side
Forum posts: 1242
You mentioned that you work with Java Servlets.
Well, this tutorial here that a quick Google search turned up mentions that % problem and says that the servlet methods all handle this automatically:
http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/
So I wonder where you run into problems?
René Brunner
Forum posts: 73
Thanks a lot Sir
It is really helpful