strange behaviour of Descriptor

Login to reply to this topic.
Wed, 2007-09-12 08:18
Joined: 2006-11-22
Forum posts: 73

Hi to all,

I am trying to send a string value from my application to java servlet using HTTP api
like
//eg "sulabh#04"
TBuf<40 > iName;
iName.Append(username);
iName.Append(_L("#"));
iName.Append(password);
iFormEncoder->AddFieldL(KPostParamName, iName);

but when i recieve this on servlet side it becomes "sulabh%2304"
I am not getting what is the reason behind this.

Please tell me what is wrong with this

Thanks in Advance


Wed, 2007-09-12 08:31
Joined: 2004-11-29
Forum posts: 1233
Re: strange behaviour of Descriptor

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.

Wed, 2007-09-12 12:09
Joined: 2006-11-22
Forum posts: 73
Re: strange behaviour of Descriptor

why this only tanslate the special character any method to prevent this from encoding

thanks

Wed, 2007-09-12 12:48
Joined: 2005-11-20
Forum posts: 1242
Re: strange behaviour of Descriptor

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

Wed, 2007-09-12 14:12
Joined: 2006-11-22
Forum posts: 73
Re: strange behaviour of Descriptor

Thanks to all of you

I can't leave such character, Please tell me how can i decode this string on server side

Wed, 2007-09-12 16:47
Joined: 2005-11-20
Forum posts: 1242
Re: strange behaviour of Descriptor

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

Thu, 2007-09-13 08:40
Joined: 2006-11-22
Forum posts: 73
Re: strange behaviour of Descriptor

Thanks a lot Sir
It is really helpful

  • Login to reply to this topic.