https://bz.apache.org/bugzilla/show_bug.cgi?id=58117

            Bug ID: 58117
           Summary: Strange XML entity escaping in JSPX files
           Product: Tomcat 8
           Version: 8.0.22
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: p...@chamaeleon.de

We are in the process of switching from Tomcat 7.0.27 to Tomcat 8 (currently:
8.0.22). During this process we noticed changes to the behaviour of escaping
XML entities inside and outside attributes.

Consider this example:

The goal is to produce valid HTML5 markup that looks like this:

<span data-text="A &ndash; B"> </span>
<span>A &ndash; B</span>

In tomcat 7 I have to use this JSPX code:

<span data-text="A &amp;ndash; B"> </span>
<span>A &amp;ndash; B</span>

1. It's impossible to use &ndash; in the JSPX code as the jsp compiler would
stumble over unknown XML entities (which &ndash; is)
2. &amp; gets un-escaped to & in the HTML markup, so the browser only sees
&ndash; which produces the desired output.

In Tomcat 8, however, the same JSPX input produces this output:

<span data-text="A &amp;ndash; B"/>
<span>A &ndash; B</span>

To me this looks wrong. I'd either expect this to produce exactly the same
output as Tomcat 7 or to at least be consistent. (This behaviour makes it also
impossible to use HTML entities inside attributes btw since we cannot produce
&ndash; as value of an attribute anymore. Without using hacks, that is.)

Regards
Markus

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to