I’ve a requirement to display the locale specific information from a resource bundle. I’ve locale specific text characters in those bundles. I pasted the language specific content and used Notepad to save it. While saving the content, I choose UTF-8 as the encoding type.
Now in my JSP page, I need to load the bundle. I use <fmt:setBundle/> to load the bundle. It is loading the correct bundle based on the locale. This is working fine. But the problem is with rendering the content. It is not able to render the content properly.
I set the encoding at the page level.
<%@ page language="java" contentType="text/html; charset=utf-8">
I also tried setting the setting the encoding using <fmt:requestEncoding/> to set the encoding. None of these worked.
Can you please help me to fix this?
I’m guessing that your bundle is a PropertyResourceBundle, i.e. it’s backed by a properties file. Properties file should be encoded in ISO 8859-1. The native2ascii tool coming with the JDK must be used to translate a file using some other encoding in ISO 8859-1 (non translatable chars will be unicode-escaped). This is all described in the Properties javadoc, as well as the PropertyResourceBundle javadoc.