GeeCON Prague 2014*
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


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: 42031
    
  64
But the web page that is generated by the servlet shows the characters correctly?


Ping & DNS - my free Android networking tools app
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: 42031
    
  64
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?
 
GeeCON Prague 2014
 
subject: How to handle special characters in web application