Struts Menu
  1. Struts Menu
  2. SM-55

No Encoding of XML Entities (e.g. &) in output


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


      From menu-config.xml (utf-8):

      <Menu name="bannerMenu" title="Schnellzugriff">
      <Item title="banner.startseite.title" page="/" />
      <Item title="Impressum & Rechtliches" page="/info/imprint"/>
      <Item title="banner.service.title" page="/info/service" />
      <Item title="Über uns" page="/" />
      <Item title="banner.alle.title" page="/" />

      properties file (iso-8859-1):

      banner.startseite.title=Startseite & Home
      banner.service.title=Service & Hilfe
      banner.alle.title=Für Euch

      JSP snippet:

      <menu:useMenuDisplayer name="ListMenu" bundle="menu">
      <menu:displayMenu name="bannerMenu" />

      The HTML result is (fetched with wget to be sure my browser doesn't mix
      it up):

      <meta [...] charset=iso-8859-1" />
      <li><a href="/" title="Startseite & Home">Startseite & Home</a></li>
      <li><a href="/info/imprint" title="Impressum & Rechtliches">Impressum &
      <li><a href="/info/service" title="Service & Hilfe">Service &
      <li><a href="/" title="<DC>ber uns"><DC>ber uns</a></li>
      <li><a href="/" title="F<FC>r Euch">F<FC>r Euch</a></li>

      <DC> and <FC> in the output are some Unicode Bytesequences

      So we have the following cases:

      1. property string with "&" results in "&"
      2. XML menuconfig with "&" results in "&"
      3. property string with "&" results in "&"
      4. Umlaut in XML results in wrong encoding
      5. Umlaut in properties results in wrong encoding

      case 1 is difficult: Should struts-menu think of properties as html
      strings or just plain text. this should be documented. In my opinion the
      tokens should be interpreted as plain text and be converted to valid xml
      text strings on output, encoding & < > and ".

      case 2 is a bug

      case 3 is like case 1

      case 4 and 5:
      i switched xml file to iso-8859-1 (xml encoding attribute and
      the file itseld) and the result was the same. it was spit out as utf-8.



          • Assignee:
            Matt Raible
            Janning Vygen
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: