• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Encoding of special characters in the request parameter

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 867
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic