File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 39551
    
  27
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 - updated with new look and Ping home screen widget
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18141
    
    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
 
Similar Threads
problem with characters é,ã and º
jsp with POI FILE System concept.
displaying special characters on struts:jsp page
extraneous characters getting introduced in XML
Using UTF-8 encoding for jsp textarea field instead HTML encoding