[
https://issues.apache.org/jira/browse/WW-4742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15883445#comment-15883445
]
Mateus Carvalho commented on WW-4742:
-------------------------------------
I know this is a weird situation, when you call the "s:text" not having a
translation, but my application has a component that sometimes receive the text
solved to print.
Ok, this is a more complete scenario:
{code:title=message.ftl|borderStyle=solid}
...
<@s.text name="${someVar}" />
...
{code}
Saved in *ISO-8859-1*
{code:title=SimpleAction.java|borderStyle=solid}
public class SimpleAction{
....
@Action(value="SimpleAction", results={
@Result(name="success", type="dispatcher",
location="resultSimpleAction.jsp"),
@Result(name="input", type="freemarker",
location="/messages/message.ftl")
})
public String simpleMethod() {
....
return "input";
}
....
}
{code}
{code:title=freemarker.properties|borderStyle=solid}
default_encoding=ISO-8859-1
{code}
My result:
{code:title=Output|borderStyle=solid}
Obrigat\u00F3rio
{code}
I downloaded the source code of Struts and removed this line:
{code:title=TextProviderHelper.java|borderStyle=solid|borderStyle=solid}
...
public static String getText(String key, String defaultMessage, List<Object>
args, ValueStack stack, boolean searchStack) {
...
//this line \/
msg = StringEscapeUtils.escapeEcmaScript(msg);
...
}
...
{code}
Now my output is right, just like in older versions of Struts:
{code:title=Output|borderStyle=solid}
Obrigatório
{code}
*Isn't this a problem, really? Should I configure something else in my
application just because of this new implementation on TextProviderHelper?*
> Problem with escape when the key from getText has no value
> ----------------------------------------------------------
>
> Key: WW-4742
> URL: https://issues.apache.org/jira/browse/WW-4742
> Project: Struts 2
> Issue Type: Bug
> Components: Core Tags
> Affects Versions: 2.5.8, 2.5.10
> Reporter: Mateus Carvalho
> Priority: Minor
> Fix For: 2.5.next
>
>
> When using an encoding like ISO-8859-1 and having the following situation:
> {code:title=message.ftl|borderStyle=solid}
> ...
> <@s.text name="Obrigatório - not mapped word in any dictionary" />
> ...
> {code}
> We have the following output after update 2.5.8:
> {code}
> Obrigat\u00F3rio - not mapped word in any dictionary
> {code}
> After careful look at the source code and issues from the 2.5.8 I found the
> problem happens just in one added line on WW-4712, the following part of the
> code:
> {code:title=TextProviderHelper.java|borderStyle=solid}
> ...
> public static String getText(String key, String defaultMessage, List<Object>
> args, ValueStack stack, boolean searchStack) {
> ...
> //This escape causes the problem
> msg = StringEscapeUtils.escapeEcmaScript(msg);
> ...
> }
> ...
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)