[ 
https://issues.apache.org/jira/browse/WW-3205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lukasz Lenart closed WW-3205.
-----------------------------
    Resolution: Not A Problem

> Escaped apostrophe in property files
> ------------------------------------
>
>                 Key: WW-3205
>                 URL: https://issues.apache.org/jira/browse/WW-3205
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Other
>    Affects Versions: 2.1.6
>            Reporter: Tamas Ruff
>            Priority: Major
>             Fix For: 6.1.0
>
>
> 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 was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to