You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Tamas Ruff (JIRA)" <ji...@apache.org> on 2009/07/24 13:09:59 UTC
[jira] Created: (WW-3205) Escaped apostrophe in property files
Escaped apostrophe in property files
------------------------------------
Key: WW-3205
URL: https://issues.apache.org/struts/browse/WW-3205
Project: Struts 2
Issue Type: Bug
Components: Other
Affects Versions: 2.1.6
Reporter: Tamas Ruff
My application contains both struts(1) and strust2 pages, and all the pages use the same property files as resource bundle. Some of the localized texts are used in javascript for both struts1 and struts2 pages. I have a problem with rendering the localized texts which contain apostrophes.
For example I have the following "base" text: Vue d'ensemble de la page
Because this localized text will be used in the JavaScript the result of rendering the tags should be:
Vue d\'ensemble de la page
(apostrophe escaped for javascript)
In the strus1 jsp page (somewhere in a javascipt JSON table) I have:
"<bean:message bundle='Struts2Resources' key='menu.item.home.tt'/>"
To obtain the expected result for this tag in the property file I should have:
'menu.item.home.tt=Vue d\\'ensemble de la page
Similarly in the strus2 jsp page (somewhere in a javascipt JSON table) I have:
"<s:text name='menu.item.home.tt'/>"
To obtain the expected result for this tag in the property file I should have:
'menu.item.home.tt=Vue d\\''ensemble de la page
In the first case the result in the struts2 page will be
Vue d\ensemble de la page
i.e. the apostrophe disappear
In the second case the result in the struts1 page will be
Vue d\''ensemble de la page
which result in javascript error.
I don't really understand why is the behavior different for these tags because I suppose that at the background both use the same JDK ResourceBundles. Please suggest an escaping solution which should work for both struts1 and struts2 tags.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.