jQuery in Action, 3rd edition
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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark " Non ascii characters are padding without reason" Watch " Non ascii characters are padding without reason" New topic

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,
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
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).
Paul Clapham

Joined: Oct 14, 2005
Posts: 19868

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
It's not a secret anymore!