Mantis - Resin
Viewing Issue Advanced Details
6160 minor always 05-02-18 13:17 05-02-18 15:13
wileysaw  
ferg  
normal  
closed 4.0.55  
no change required  
none    
none  
0006160: <character-encoding> not set with @include in JSP pages
We have many pages with Spanish text that include a common header file. For example, page1.jsp has <%@include file=”header.jsp” %>, which is followed by String literals in Spanish.

 

header.jsp includes a page directive to set the charset to UTF-8. <%@page contentType="text/html; charset=UTF-8" %>. This worked fine in Resin 3. In Resin 4, the Spanish accented text will be displayed incorrectly. However, if I place the page directive in page1.jsp, then it will work.

Regardless where the page directive is, in the generated java file, this same line is added:

response.setContentType(“text/html; charset=UTF-8”);

Looking at the encoded literals, it looks like ISO-8859-1 is used when the page directive is in header.jsp and UTF-8 is used when the page directive is in page1.jsp. For example, one same accented character are encoded these two ways:

\u00c3\u00a9 -- displayed incorrectly.
\u00e9 --> displayed correctly

 

According to the help doc, Resin uses ISO-8859-1 as the default encoding, so I added <character-encoding>utf-8</character-encoding> in resin.xml (tried globally and in the web-app). It had no effect.
Workaround:
Add <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> to each of the erroneous JSP pages

Notes
(0006834)
ferg   
05-02-18 15:13   
This change was a JSP compliance fix for Resin 4.