DisplayTag
  1. DisplayTag
  2. DISPL-487

escapeXml attribute doesn't escape spaces to  

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Within our project data is read from a database and displayed via the displaytag table.
       
      The escapeXml="true" is set for the column tag.

      We expected to have data " Name" to be escaped into "  Name".

      Is it possible to have the escapeXml working for space? This doesn't happen.

      Note:
      It looks like only the & " en ' are transformed to there respective &amp &quot en ' No other characters are escaped.

      The possibility of having a global (configuration) setting for the escapXml (like the defaultHtmlEscape of Spring) would be great!

        Activity

        Hide
        daniel weijers added a comment -
        looking at the code, only the escapeXml method is used, for both XML and HTML
        if a seperated call to the escapeHtml can be made for HTML, a lot more (in effect all html 4.0) will be escaped, according to the javadoc of the StringEscapeUtils class. Hopes this helps


        <snippet could be added to the EscapeXmlColumnDecorator.java class>

        if (media.equals(MediaTypeEnum.XML)) {
            return StringEscapeUtils.escapeXml(columnValue.toString());
        }
        if (media.equals(MediaTypeEnum.HTML)) {
           return StringEscapeUtils.escapeHtml(columnValue.toString());
        }
        Show
        daniel weijers added a comment - looking at the code, only the escapeXml method is used, for both XML and HTML if a seperated call to the escapeHtml can be made for HTML, a lot more (in effect all html 4.0) will be escaped, according to the javadoc of the StringEscapeUtils class. Hopes this helps <snippet could be added to the EscapeXmlColumnDecorator.java class> if (media.equals(MediaTypeEnum.XML)) {     return StringEscapeUtils.escapeXml(columnValue.toString()); } if (media.equals(MediaTypeEnum.HTML)) {    return StringEscapeUtils.escapeHtml(columnValue.toString()); }
        Hide
        Michael Osipov added a comment -
        From my point of view, this bug is invalid. a space (0x20) does not equal a non-breaking space. Thus it cannot be replaced with it.
        Show
        Michael Osipov added a comment - From my point of view, this bug is invalid. a space (0x20) does not equal a non-breaking space. Thus it cannot be replaced with it.

          People

          • Reporter:
            daniel weijers
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: