History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: SM-55
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Matt Raible
Reporter: Janning Vygen
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Struts Menu

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

Created: 24/Aug/06 03:36 PM   Updated: 24/Aug/06 03:36 PM
Component/s: Displayers
Affects Version/s: 2.4.1
Fix Version/s: None


 Description  « Hide
From menu-config.xml (utf-8):

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

properties file (iso-8859-1):

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

JSP snippet:

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

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 &
Rechtliches</a></li>
<li><a href="/info/service" title="Service &amp; Hilfe">Service &amp;
Hilfe</a></li>
<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 "&amp;" results in "&"
3. property string with "&amp;" results in "&amp;"
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.


 All   Comments   Change History   FishEye      Sort Order:
There are no comments yet on this issue.