You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/08/22 04:46:39 UTC

DO NOT REPLY [Bug 22645] New: - <%@ include file ="included.jsp" %> encoding problem

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=22645>.
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=22645

<%@ include file ="included.jsp" %> encoding problem

           Summary: <%@ include file ="included.jsp" %> encoding problem
           Product: Tomcat 4
           Version: Unknown
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Jasper
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: HeartBit@runeconsulting.com


When the static including (<%@ include %>) JSP file has no specified character 
set for Response (<% page contentType %> but included file has, the including 
file has treated as "iso-8859-1" encoding and the included file treated as 
specified (as contentType) encoding" 

By the term “treated as XXX encoding”, I meant the Reader for XML(JSP) 
document has XXX encoding.

I think the XML(JSP) should be treated as specified by <?xml encoding=”XXX”>. 
And the XML, generated from JSP file which has no specific xml encoding 
equivalent information, should be treated as default encoding. 
(System.getProperty(“file.encoding”)) like <?xml encoding=”** value from 
System.getProperty(“file.encoding”) **”>.

Cf.) example source sinps
--- including.jsp ---
<%@ include file ="included.jsp" %>
including : 한글
--- 
--- included.jsp ---
<%@ page contentType="text/html; charset=euc-kr"%>
included : 한글
---

Cf.) possible patch to solve this problem
---
Index: ParserController.java
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-
4.0/jasper/src/share/org/apache/jasper/compiler/ParserController.java,v
retrieving revision 1.18
diff -u -r1.18 ParserController.java
--- ParserController.java	21 May 2002 01:40:13 -0000	1.18
+++ ParserController.java	22 Aug 2003 02:40:56 -0000
@@ -122,9 +122,8 @@
     /*
      * The encoding of the "top" file. This encoding is used
      * for included files by default.
-     * Defaults to "ISO-8859-1" per JSP spec.
      */
-    private String topFileEncoding = "ISO-8859-1"; 
+    private String topFileEncoding = System.getProperty("file.encoding"); 
     
     /*
      * The 'new' encoding required to read a page.

--- 

I’ve removed the comment which has “per Spec”. I’ve reviewed the JSP 1.2 final 
spec. But it has nothing to do with the encoding of JSP file. But it only read 
that the Response should have “iso-8859-1” as default.