Bug 29386 - pageEncoding attribute is ignored under certain conditions
Summary: pageEncoding attribute is ignored under certain conditions
Status: RESOLVED DUPLICATE of bug 25899
Alias: None
Product: Tomcat 4
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 4.1.30
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-04 08:40 UTC by Mario Winterer
Modified: 2004-11-28 14:16 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mario Winterer 2004-06-04 08:40:42 UTC
If a single page directive is split into multiple instances (according to 
JSP.2.10.1 "The page Directive"), the "pageEncoding" attribute is ignored 
under the following conditions:
1) The page directive that contains the "pageEncoding" attribute is NOT 
defined in the same instance as the "contentType" attribute.
2) The page directive that contains the "pageEncoding" attribute appeares 
AFTER the directive that contains the contentType" attribute.

If both conditions are true, pageEncoding is ignored and instead, the 
character encoding specified by the "contentType" attribute seems to be used!

example 1:
<%@page contentType="text/html; charset=UTF-8"%>
<%@page pageEncoding="ISO-8859-1"%>

used charset: I don't know, but it is NOT ISO-8859-1, because special LATIN-1 
characters are "unreadable" in the generated java servlet code.

example 2:
<%@page pageEncoding="ISO-8859-1"%>
<%@page contentType="text/html; charset=UTF-8"%>

used charset: ISO-8859-1 (which is correct!)

At least it is a bug that the page directives are position dependent! (see 
JSP.2.10.1 "The page Directive").

This bug has already been fixed in Tomcat 5 (see bug #29342 and bug #27517)
Comment 1 Mark Thomas 2004-11-28 23:16:58 UTC
There is some ambiguity in the JSP 1.2 spec regarding page encoding and 
content type. This was clarified in 
http://www.jcp.org/aboutJava/communityprocess/maintenance/jsr053/errata_1_2_a_2
0020321.html

This bug actually has the same root cause as 25899, hence I am marking this 
one as a duplicate.

*** This bug has been marked as a duplicate of 25899 ***