struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yasser Zamani (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (WW-4742) Problem with escape when the key from getText has no value
Date Fri, 24 Feb 2017 11:02:44 GMT

    [ https://issues.apache.org/jira/browse/WW-4742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15882454#comment-15882454
] 

Yasser Zamani edited comment on WW-4742 at 2/24/17 11:01 AM:
-------------------------------------------------------------

[~mtsbarbosa], about your .properties files, As per the [javadoc|http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html#load(java.io.InputStream)],
they are by default read as ISO-8859-1, so, you'd need to save them as ISO-8859-1 (you can
use +\u+ for UTF-8 character if needed).

And about your .jsp files, it works regardless of you save as UTF-8 or ISO-8859-1, but if
you declare your page content type correctly e.g.
{code:xml}
<%@ page contentType="text/html; charset=ISO-8859-1" %>
{code}

I've tested these, fortunately Struts works properly and there are nothing to do with Struts
itself. just apply above and enjoy ;)


was (Author: yasser.zamani):
[~mtsbarbosa], about your .properties files, As per the [javadoc|http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html#load(java.io.InputStream)],
they are by default read as ISO-8859-1, so, you'd need to save them as ISO-8859-1.

And about your .jsp files, it works regardless of you save as UTF-8 or ISO-8859-1, but if
you declare your page content type correctly e.g.
{code:xml}
<%@ page contentType="text/html; charset=ISO-8859-1" %>
{code}

I've tested these, fortunately Struts works properly and there are nothing to do with Struts
itself. just apply above and enjoy ;)

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

Mime
View raw message