I am facing issue while trying into insert special symbols like pound character (£ or ₤ ) in DB. These are getting displayed as ?? in the front end
We use tomcat as app server and have below configration in that
URIEncoding="UTF-8"
Before inserting the text to DB we are performing the below check
String Text = new String(request.getParameter("Text").getBytes("8859_1"),"UTF-8");
I dont have much idea about what the above code does
But when i remove "URIEncoding="UTF-8" from tomcat server.xml,these characters are loading fine
According to http://confluence.atlassian.com/display/DOC/Configuring+Tomcat%27s+URI+encoding by default tomcat uses "ISO-8859-1" encoding
can anyone help on this please?
Thanks in Advance
You’re asking Tomcat to give you values formatted as UTF-8, then converting that to a byte array based on ISO-8859-1 character set code points. You’re then directly casting those values back to UTF-8 code points, which is resulting in the characters getting garbled.
Just remove the conversion stuff, leave the
URIEncoding="UTF-8"entry in your config, and it should work fine.Also, keep in mind that your output encoding is important. If you’re sending back UTF-8 encoded pages, but have the encoding set differently in the page’s meta tags or the
Content-EncodingHTTP response header, you’ll get garbled results for certain characters.