When leveraging the messaging composition engine within WebSphere Commerce, you may notice that some special characters are not displayed correctly.
Resolving the problem
By default, WebSphere Commerce uses UTF-8 character encoding. There are a few different places within the application server where the encoding type may be set:
- Sometimes, the values specified in the WebSphere Application Server encoding.properties file may override the content type specified in the JSP.
Some JSTL tags, such as <fmt:message "string">, cause WebSphere Application Server to reset the content type of the response to the instance's default encoding. The encoding.properties file contains a list of language/character set pairs. When the charset attribute is not explicitly defined in the HTTP request/response, the application server references the encoding.properties file. You can try changing the values from the default ISO-8859-1 to UTF-8 for your applicable languages. The UTF-8 character encoding generally represents an all-encompassing character set for many different languages. The application server will need to be restarted for these changes to take effect.
*Note: This is a global configuration change that will affect all applications running on WebSphere Application Server.
- The encoding type is also specified in the WebSphere Commerce LANGUAGE database table from the ENCODING column. Ensure this value is set to UTF-8 (or your applicable encoding type) for your language.
- Try manually setting the content type of the response to UTF-8 within the JSP itself:
<% page pageEncoding="UTF-8" %>
<% response.setContentType("text/html;charset=UTF-8"); %>
- The following two JVM parameters set in the WebSphere Application Server Administration Console will also override the character encoding type used by the application server. These parameters should only be used in the event the above approaches do not resolve the problem.
Servers > Application servers > Java and Process Management > Process Definition > Java Virtual Machine > Generic JVM Arguments