It is very strange, why we can include a utf-8 jsp correctly, but not utf-8 html? The worst is in eclipse we manage to have utf-8 html display correctly. But when deploy to JBoss 4.2.3 in WinServer 2003, the included utf-8 html portion still in garbage. Thse included utf-8 jsp display correctly.
UTF-8 HTML pages need to have the proper META tag in the <head> block:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
If you are including an HTML file in a JSP page, you can run it through the JSP processor so that everything gets encoded consistently. We've done this for JavaScript files that we wanted to modify at runtime.
Add the following to your web.xml:
<jsp-config>
<jsp-property-group>
<description>Property group for common configuration for all the JSP's</description>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.html</url-pattern>
<el-ignored>false</el-ignored>
<page-encoding>UTF-8</page-encoding>
</jsp-property-group>
</jsp-config>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With