Bug 68890 - Several JSPs in the manage application have contradicting encoding
Summary: Several JSPs in the manage application have contradicting encoding
Alias: None
Product: Tomcat 11
Classification: Unclassified
Component: Manager (show other bugs)
Version: 11.0.0-M18
Hardware: All All
: P2 normal (vote)
Target Milestone: -------
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2024-04-12 11:49 UTC by Michael Osipov
Modified: 2024-04-15 20:36 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Michael Osipov 2024-04-12 11:49:23 UTC
This also applies to other versions of Tomcat.
List the JSP files:
osipovmi@deblndw011x:~/var/Projekte/tomcat (main *=)
$ find webapps/manager -name \*.jsp

and open them. Many have the XML prolog set "<?xml version="1.0" encoding="UTF-8"?>", but set the output encoding to
 <%@page session="false" contentType="text/html; charset=ISO-8859-1" %>
 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>

This is weird and it should be consistently one encoding, the prolog and those JSP/HTML tags.
Comment 1 Michael Osipov 2024-04-15 08:49:04 UTC
As far as I understand they should not contain an XML prolog at all since they aren't JSPX
Comment 2 Christopher Schultz 2024-04-15 15:46:40 UTC
I've fixed the encoding declaration in 11402a58acfde441d947332c4a6f110a24658efd in main and back-ported to the other versions.

I'm not going to remove any of the XML stuff at this point, since the page also declares that is it XHTML. I'm not sure that .jsp versus .jspx has anything to do with it, as any file processed by the JSP engine can produce output of any kind, only identified by its Content-Type.
Comment 3 Mark Thomas 2024-04-15 16:52:40 UTC
For the record, Chris is correct.

The JSP prologue and pageEncoding MUST agree for JSP documents in XML syntax.

For JSP pages that are not in XML syntax, the prologue is just template text that will be passed through to the output.
Comment 4 Christopher Schultz 2024-04-15 20:36:19 UTC
(In reply to Mark Thomas from comment #3)
> The JSP prologue and pageEncoding MUST agree for JSP documents in XML syntax.


pageEncoding specifies the encoding of the source document (.jsp file) but the response. But maybe they also have to agree?