DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25899>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25899 Encoding bug in Jasper compiler when using <%@ include > directive Summary: Encoding bug in Jasper compiler when using <%@ include > directive Product: Tomcat 4 Version: 4.1.29 Platform: All OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: Jasper 2 AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] There is a bug in Jasper compiler that incorrectly assigns ISO-8859-1 encoding for included file when including files using <%@ include file="..."> directive and the included file contains <%@ page > directive. For example: page1.jsp: <%@ page contentType="text/html; charset=ISO-8859-2" %> Test łćżĆŁŃ <br><br> <%@ include file="page2.jsp"%> page2.jsp: <%@ page import="java.util.*" %> Test łćżĆŁŃ <br><br> Jasper correctly recognizes encoding of file page1.jsp as ISO-8859-2. Since page2.jsp does not have its encoding set and it is included from page1.jsp, it should also have ISO-8859-2 encoding. Jasper incorrectly treats this file as having ISO-8859-1 encoding. The problem disappears when <%@ page import="java.util.*" %> directive is removed from page2.jsp. Patch for this bug follows: Index: ParserController.java =================================================================== RCS file: /home/cvspublic/jakarta-tomcat- jasper/jasper2/src/share/org/apache/jasper/compiler/ParserController.java,v retrieving revision 1.4.2.1 diff -c -r1.4.2.1 ParserController.java *** ParserController.java 18 Jul 2002 18:04:24 -0000 1.4.2.1 --- ParserController.java 5 Jan 2004 12:52:09 -0000 *************** *** 260,270 **** int loc = contentType.indexOf("charset="); if (loc != -1) { newEncoding = contentType.substring(loc+8); - return; } } - if (newEncoding == null) - newEncoding = "ISO-8859-1"; } else { return; } --- 260,270 ---- int loc = contentType.indexOf("charset="); if (loc != -1) { newEncoding = contentType.substring(loc+8); } + if (newEncoding == null) + newEncoding = "ISO-8859-1"; + return; } } else { return; } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]