Do you have your struts.custom.i18n.resources property correctly
assigned to your bundle(s)?
Em 05-04-2010 11:27, Marc Logemann escreveu:
Hi,
imagine the following jsp (saved in UTF-8 encoding):
------ snipp -------
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<body>
Hauptmenü<br/>
<s:text name="menu.mainmenu"/><br/>
<s:property value="foo"/><br/>
</body>
</html>
------ END snipp -------
Now i have a resource bundle like that:
menu.mainmenu=Hauptmen\u00fc
Inside its the german u with 2 dots on top.
Now i run the following action:
------ snipp -------
public class TestStruts2Action extends ActionSupport {
String foo;
public String execute() {
foo = getText("menu.mainmenu");
return Action.SUCCESS;
}
public String getFoo() {
return foo;
}
}
------ END snipp -------
When i run this in the browser, i am getting 3 different things.
* The hardcoded "Hauptmenü" in the JSP will be displayed correcty. This means
that the browser has correctly read the stream with a UTF-8 encoder.
* The string gets out of the bundle via<s:text ...> wil be broken. Instead of an Entity
or the raw UTF-8 character, i am getting "ef bf bd" as last character, means unknown
character.
* the third way of exposing attribute "foo" will result in the word
"Hauptmenü" (with the correct HTML entity). Remeber, it comes from the same bundle
as you can see in the action.
So something is wrong with<s:text> tag but what. I tried solving this one for about 4 hours
without any luck. When switching the browser encoding to ISO-8859-1, the<s:text> works but
then of course variant 1 doesnt work because i hardcoded the "umlaut" to the JSP and i
definitely need that running because thats the natural way to do.
Thanks for hints.
---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org