This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JSP and the fly likes  Non ascii characters are padding without reason Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark " Non ascii characters are padding without reason" Watch " Non ascii characters are padding without reason" New topic
Author

Non ascii characters are padding without reason

zimbu bolleddu
Ranch Hand

Joined: Jan 14, 2008
Posts: 35
Hi all,

here is my issue :

I have description field in my jsp page, when user enters some non ASCII characters as shown below :

This is user had entered the input string is :
"Hello ������� Hello" (without quotes)

When he edits for the first time without change anything in the the string and save, then it became :
"Hello Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã? Hello" (without quotes)

Then again one more time, it became :
"Hello Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â? Hello" (without quotes)

Like wise it is getting increased its size. I'm saving the data to Oracle 10g database from jsp.

Please suggest what to do to rectify the problem.

Thanks & regards,
Achchayya
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42367
    
  64
Make sure that you the same encoding throughout the application - in the HTML form where the data is entered, during handling on the servlet container/app server, when storing it in the DB, and all the way back. UTF-8 would be a good candidate for the encoding (note that the encoding needs to be specified when creating the DB table, so if that's fixed already, you may have to use that encoding).


Ping & DNS - my free Android networking tools app
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18711
    
    8

Here's an article which goes into more detail about that:

Character Conversions from Browser to Database
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Non ascii characters are padding without reason