• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Encoding of special characters in the request parameter

 
Ray Cutler
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me explain the problem by giving an example.

In a form, I have a text field, First Name. I enter a value ��������. I submit the form. Upon the submit, the special characters in the first name is encoded to some weird value in the request parameter. This weird value is inserted in the database column. These encoded characters occupy more characters per normal character. So while inserting into the database,it exceeds the database column limit and it throws an exception.

How do I prevent this encoding of special characters in the Request parameter?
 
Francis Siu
Ranch Hand
Posts: 867
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Ray Cutler
Um....If I do the encoding, first of all, I check the ASCII value for each character as the ASCII value may be out of the range. I am not sure that I answer your question but my idea is check the ASCII value for each value first and using (MOD) function to avoid some problem and then decide which Linear equation to encode the string. May be you can check which range of character using much byte to store, as I do not know the size of storing each character.
Just my suggestion and my simple idea
 
Petr Blahos
Ranch Hand
Posts: 131
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ray,

Let me guess: You are talking about http client (like mozilla) on one
side and a servlet on the other side? Correct?

Firstly you must realize that it is not the servlet who encodes anything.
It is the web browser. You cannot prevent it. I would suggest that you
find out what kind of encoding it is (standard), what the character
encoding in the browser is (one of the headers). Then you can do it.

Look up HTTP RFC and have a nice evening ;-)

Petr
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic