https://issues.apache.org/bugzilla/show_bug.cgi?id=52335

             Bug #: 52335
           Summary: Tomcat escapes all the \% in Template Text as %.
           Product: Tomcat 5
           Version: 5.5.34
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: zhangl...@cn.fujitsu.com
    Classification: Unclassified


hi,

I noticed that there is a problem at the % escape on Tomcat 5.5.34.

(1)The problem
    The JSP Specification 2.0 says:
    ------
    JSP.1.6 Quoting and Escape Conventions
    → Quoting in Template Text
      ・A literal <% is quoted by <\%
    ------

    But the result of the % escape on Tomcat 5.5.34 is :
    ------
    Not only the \% of <\% is escaped as %.
    All the \% in Template Text is escaped as %.
    ------

    If I want to show \% on the HTML page, it is needed to write \\% in a JSP
file.

    The problem  also occurs on Tomcat 5.5.23 or Tomcat7.0.8.
    And it seems that the problem has already occured on Tomcat 5.5.0.

(2)The reason
    The reason of the problem is that the following method is not implemented
    according to JSP Specification.
         ・The class:
                org.apache.jasper.compiler.Parser
         ・The method:
               void parseTemplateText(Node parent)
         ・The part of source:
           ------
           else if (ch == '\\') {
                if (!reader.hasMoreInput()) {
                    ttext.write('\\');
                    break;
                }
                // Look for \% or \$
                // Only recognize \$ if isELIgnored is false
                char next = (char)reader.peekChar();
                if (next == '%' || (next == '$' && !pageInfo.isELIgnored())) {
▲
                    ch = reader.nextChar();
                }
            }
           ------

Is it a bug?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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