Am Mittwoch, 23. August 2006 18:35 schrieb Matt Raible:
> Have you tried just using &?

Yes, i  used well-formed XML. 

I typed it wrong because i wrote it in the forum and thought the software 
would not print my & correctly. I should have checked it in the post 
preview. Sorry for this inconvinience.

A better example with ampersand and german umlauts:

From my 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>

And in my properties file (iso-8859-1):
 
 banner.startseite.title=Startseite & Home
 banner.service.title=Service &amp; Hilfe
 banner.alle.title=Für Euch

In my JSP:

  <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>

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 dont know, as endocing problems are too difficult for me :-)
i switched my xml to iso-8859-1 (not only xml encoding on line 1 but the file 
itseld) and the result was the same. it was spit out as utf-8.


kind regards,
Janning



> On 8/23/06, Janning Vygen <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > if you have a & in your menu title it will not be translated in the
> > aproppiate HTML Entitiy.
> >
> >   <Item title="Service &amp;amp; Hilfe" ...
> >
> > I used ListMenu for it, but i think it is  a bug by design as the menu
> > title is just printed as is. the output should be well-formed xml,
> > shouldn't it?


-- 
PLANWERK 6 websolutions
Venloer Straße 8, 40477 Düsseldorf
Tel: (0211) 302666-0
Fax: (0211) 302666-10 
http://www.planwerk6.de/

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
struts-menu-user mailing list
struts-menu-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/struts-menu-user

Reply via email to