I need to display text in Hindi (or any regional language) on browser screens. I get this text from the database.
To do this, I started at a very basic level with the following:
String escapedStr = "\\u0905\\u092d\\u0940 \\u0938\\u092e\\u092f \\u0939\\u0948 \\u091c\\u0928\\u0924\\u093e"; String hindiText = StringEscapeUtils.unescapeJava(escapedStr); System.out.println(hindiText); return hindiText;
I can get the hindi text perfectly in the hindiText variable. But when I print it on the eclipse console or on the browser screen, I get only ???? ?? ?? ???? ?? ??
I set the default character encoding for my browser as well as my eclipse console for UNICODE (UTF-8). But there is still no success.
Can someone help me solve this problem? What setting am I missing?
Just fyi - I can open Hindi sites in my browser. Therefore, language settings are not a problem.
EDIT
Since I use JSP files for my presentations, I added the following to my web.xml to set character encoding all over the world. Link: Follow-up
<jsp-config> <jsp-property-group> <url-pattern>*.jsp</url-pattern> <page-encoding>UTF-8</page-encoding> </jsp-property-group> </jsp-config>
But still no success!
source share