Bug 66536

Summary: tagsfiles seem to be compiled with the wrong source encoding
Product: Tomcat 9 Reporter: Holger Klawitter <info.asf>
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 9.0.73   
Target Milestone: -----   
Hardware: PC   
OS: Linux   
Attachments: minimal webapp

Description Holger Klawitter 2023-03-21 13:47:54 UTC
Created attachment 38526 [details]
minimal webapp

Hi there,

When I let tomcat/jasper compile the following tag file 
(WEB-INF/tags/umlaut.jsp):

<%@tag
  trimDirectiveWhitespaces="true"
  pageEncoding="UTF-8"
%>
<%= "ü does not work" %> // bytes c3 bc

compiles into umlaut_tag.java in which the umlaut is doubly utf-8 encoded
like this:

      out.print( "ü does not work" ); // bytes c3 83 c2 bc

String literals in jsp files work just fine, so I'd like to rule out
errors in my encoding setup.

(Tomcat is running with LC_ALL=de_DE.UTF-8.)

I've attached a minimal webapp demonstrating that jsp is working, but the tag files are not.

Regards,
  Holger
Comment 1 Mark Thomas 2023-03-22 17:16:47 UTC
Thanks for the report. I can confirm that this is a Tomcat bug.

Fixed in:
- 11.0.x for 11.0.0-M5 onwards
- 10.1.x for 10.1.8 onwards
-  9.0.x for  9.0.74 onwards
-  8.5.x for  8.5.88 onwards

It you want a short-term work-around, add a single space character after <%@tag and before the newline.