Bug 40440

Summary: Problem with characters when include static html
Product: Tomcat 5 Reporter: Tomek Brauncajs <tbrauncajs>
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: Unknown   
Target Milestone: ---   
Hardware: Other   
OS: other   
Attachments: testing examples

Description Tomek Brauncajs 2006-09-07 16:29:24 UTC
When I try to include static html page with characters encoded with UTF-8 then
this characters are displayed incorrectly. When I do the same page as jsp and I add 

<%@ page contentType="text/html; charset=UTF-8"%> in the beginning then
everything is ok. 

following there are example of code I do for testing. The same example (with
static html) works fine in Tomcat 4

main.jsp

<%@ page contentType="text/html; charset=UTF-8"%>
<html>
<body>
HTML:<%@include file="/included.htm" %>
<br/>
JSP:<%@include file="/included1.jsp" %>
</body>
</html>


included.htm

&#261;&#281;&#347;&#263;&#380;&#378;&#324;&#322;óÓ&#321;&#262;&#377;&#379;&#260;&#346;&#323;&#280;


included.jsp

<%@ page contentType="text/html; charset=UTF-8"%>
&#261;&#281;&#347;&#263;&#380;&#378;&#324;&#322;óÓ&#321;&#262;&#377;&#379;&#260;&#346;&#323;&#280;

I also attache this examples
Comment 1 Tomek Brauncajs 2006-09-07 16:31:50 UTC
Created attachment 18834 [details]
testing examples
Comment 2 Mark Thomas 2006-09-07 23:25:29 UTC

*** This bug has been marked as a duplicate of 31201 ***
Comment 3 Tomek Brauncajs 2006-09-08 10:48:21 UTC
but the problem still exist when I use

<%@include file="/included.htm" %>


In case of using < jsp:include...  fileEncoding parameter fixed the problem but
no t for <%@include....
Comment 4 Mark Thomas 2006-09-08 10:55:50 UTC
You need to set the fileEncoding on the DefaultServlet

Bugzilla is not a support forum. Please address further questions to the users list.
Comment 5 Tomek Brauncajs 2006-09-08 11:01:01 UTC
i know that it is not the forum but I set fileEncoding on the DefaultServlet and
when i use Request time include action the characters are ok but when I use
Translation time include then there is still problem with incorrect characters.
Comment 6 william.barker 2006-09-08 18:43:56 UTC
(In reply to comment #5)
> i know that it is not the forum but I set fileEncoding on the DefaultServlet 
and
> when i use Request time include action the characters are ok but when I use
> Translation time include then there is still problem with incorrect 
characters.

This is per the JSP spec.  You need to include a <%@page pageEncoding="utf-8" %
> in the included file, or you get iso-latin-1.