Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 1D8A7200D5F for ; Mon, 18 Dec 2017 20:19:06 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 1C2DD160BFB; Mon, 18 Dec 2017 19:19:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 62C39160C2A for ; Mon, 18 Dec 2017 20:19:05 +0100 (CET) Received: (qmail 57614 invoked by uid 500); 18 Dec 2017 19:19:04 -0000 Mailing-List: contact issues-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list issues@struts.apache.org Received: (qmail 57539 invoked by uid 99); 18 Dec 2017 19:19:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Dec 2017 19:19:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 04911C1C82 for ; Mon, 18 Dec 2017 19:19:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.211 X-Spam-Level: X-Spam-Status: No, score=-99.211 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 2Zp1nJitVJuX for ; Mon, 18 Dec 2017 19:19:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id E99E95FBCA for ; Mon, 18 Dec 2017 19:19:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 0975CE0F4E for ; Mon, 18 Dec 2017 19:19:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 7385D240F6 for ; Mon, 18 Dec 2017 19:19:00 +0000 (UTC) Date: Mon, 18 Dec 2017 19:19:00 +0000 (UTC) From: "Augusto Souza (JIRA)" To: issues@struts.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (WW-4742) Problem with escape when the key from getText has no value MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 18 Dec 2017 19:19:06 -0000 [ https://issues.apache.org/jira/browse/WW-4742?page=3Dcom.atlassian.ji= ra.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1629550= 1#comment-16295501 ]=20 Augusto Souza edited comment on WW-4742 at 12/18/17 7:18 PM: ------------------------------------------------------------- [~lukaszlenart], I'm working in the same project/problem related by [~mtsba= rbosa].=20 Its enough if change the scape order, first escapeHtml4, and after escapeEc= maScript. In the version 2.5.10.1 the code works like this: {code:java} msg =3D defaultMessage; // Test xpto' and xpt=C3=B3 msg =3D StringEscapeUtils.escapeEcmaScript(msg); // Test xpto\' and xpt\u00= F3 msg =3D StringEscapeUtils.escapeHtml4(msg); // Test xpto\' and xpt\u00F3 {code} Note that in the above example escapeHtml4 doesn't even make sense. My proposed solution to avoid special characters problems is: {code:java} msg =3D defaultMessage; // Teste xpto' and xpt=C3=B3 msg =3D StringEscapeUtils.escapeHtml4(msg); // Teste xpto' and xptó msg =3D StringEscapeUtils.escapeEcmaScript(msg); // Teste xpto\' and xpt&oa= cute; {code} I hope you consider this solution, thanks was (Author: augustosouza): [~lukaszlenart], I'm working in the same project/problem related by [~mtsba= rbosa].=20 Its enough if change the scape order, first escapeHtml4, and after escapeEc= maScript. In the version 2.5.10.1 the code works like this: {code:java} msg =3D defaultMessage; // Test xpto' and xpt=C3=B3 msg =3D StringEscapeUtils.escapeEcmaScript(msg); // Test xpto\' and xpt\u00= F3 msg =3D StringEscapeUtils.escapeHtml4(msg); // Test xpto\' and xpt\u00F3 {code} Note that in the above example escapeHtml4 doesn't even make sense. My purpose to avoid special characters problems is: {code:java} msg =3D defaultMessage; // Teste xpto' and xpt=C3=B3 msg =3D StringEscapeUtils.escapeHtml4(msg); // Teste xpto' and xptó msg =3D StringEscapeUtils.escapeEcmaScript(msg); // Teste xpto\' and xpt&oa= cute; {code} I hope you consider this solution, thanks > 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 > Assignee: Lukasz Lenart > Priority: Minor > Fix For: 2.6 > > > When using an encoding like ISO-8859-1 and having the following situation= : > {code:title=3Dmessage.ftl|borderStyle=3Dsolid} > ... > <@s.text name=3D"Obrigat=C3=B3rio - 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 t= he problem happens just in one added line on WW-4712, the following part of= the code: > {code:title=3DTextProviderHelper.java|borderStyle=3Dsolid} > ... > public static String getText(String key, String defaultMessage, List args, ValueStack stack, boolean searchStack) { > ... > //This escape causes the problem > msg =3D StringEscapeUtils.escapeEcmaScript(msg); > ... > } > ... > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)