aspose file tools*
The moose likes Servlets and the fly likes How to handle special characters in web application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to handle special characters in web application" Watch "How to handle special characters in web application" New topic
Author

How to handle special characters in web application

Naga Chalapathi Rao
Greenhorn

Joined: Oct 14, 2007
Posts: 3
Hi,

I have a problem at hand. I tried to specify the encoding format in HTML page using <meta> tag, also set the character encoding of request object before accessing the parameters to "UTF-8". Tried to check encoding type using log statement, it is showing "UTF-8", but when am trying to print parameters after fetching, am seeing either garbage value or no signof special character in some cases. No clue why this is so ? can some one help me figuring it out ?

Thanks,
Chalap
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
To where are you printing the parameters?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
But the web page that is generated by the servlet shows the characters correctly?


Ping & DNS - updated with new look and Ping home screen widget
Naga Chalapathi Rao
Greenhorn

Joined: Oct 14, 2007
Posts: 3
Thanks for response.

I am trying to print the input in system console. I do see correct input when i invoke javascript alert.
Naga Chalapathi Rao
Greenhorn

Joined: Oct 14, 2007
Posts: 3
One addition to my post. The web page shows it correctly but i see wrong values in DB after storing. Perhaps i think the charset of DB is having some role to do with this.

I tried to print the input in console of IDE to verify and issue is obesrved in this situation.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
The console may not support Unicode, so that's not necessarily an indication that something is going wrong.

Is the database set to Unicode encoding?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to handle special characters in web application
 
Similar Threads
Character encoding not working for j_security_check
Charset & encoding Problem
Unicode characters - javax . xml . transform . Transformer
XML file parsed with encoding "ISO-8859-1" but not with "UTF-8"
Converting from ISO-8859-1 to UTF-8