Monday, December 21, 2015

Struts 1.2 in WebLogic 12.1.3, german characters encoding issue

"As of WebLogic Server 12.1.3, the default value of the encoding element for the jsp-descriptor element in weblogic.xml is UTF-8 for JSP pages. Prior to WebLogic Server 12.1.3, the default value for JSP encoding was ISO-8859-1."
If you have issues
1) Add <%@ page contentType="text/html;charset=UTF-8" %> line on top of every jsp page. 

 2) Add 
 <properties>
 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
 </properties>

 In pom.xml  

 3) Add 
 <filter>
 <filter-name>struts2</filter-name>
 <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
 </filter>
 <mime-mapping>
 <extension>jsp</extension>
 <mime-type>text/html;charset=UTF-8</mime-type>
 </mime-mapping>
 In web.xml 

 4) Add 
 <jsp-config>
 <jsp-property-group > 
 <url-pattern>*.jsp</url-pattern>
 <page-encoding>UTF-8</page-encoding>
 </jsp-property-group>
 </jsp-config> in web.xml – 

5) Add <constant name="struts.i18n.encoding" value="UTF-8"/> In struts-config.xml 


 6) change text encoding to UTF-8 in the properties file. 

7) Add the below to your weblogic.xml.

<charset-params>
 <input-charset>
   <resource-path>/*</resource-path>
   <java-charset-name>ISO8859-1</java-charset-name>
 </input-charset>
</charset-params> 


(see oracle Support "Default JSP Encoding Changed to UTF-8 (Doc ID 2053210.1)" )

(it should be ISO8859-1, not ISO8859_1)

Also, to determine which encoding you are actually using, check in your html for "<meta http-equiv="content-type" content="text/html; charset=utf-8" /> " . And in the browser (IE in my case) you have a menu "view-encoding"...



No comments: