This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to handle special characters in web application

 
Naga Chalapathi Rao
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To where are you printing the parameters?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But the web page that is generated by the servlet shows the characters correctly?
 
Naga Chalapathi Rao
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic