struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maurizio Cucchiara (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (WW-4041) JSONValidationInterceptor and quotes in message
Date Tue, 09 Apr 2013 10:16:16 GMT

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

Maurizio Cucchiara updated WW-4041:
-----------------------------------

    Description: 
Hello,
There is a problem with org.apache.struts2.json.JSONValidationInterceptor
This class is using StringEscapeUtils.escapeEcmaScript(String) to escape the generated JSON
string.
The problem is that StringEscapeUtils.escapeEcmaScript escapes the apostrophes. Some JSON
implementations accept the escaped apostrophes but some other don't and they are not able
to parse the JSON.
I think there should be at least an option to disable apostrophe escaping. But as I believe
escaping apostrophe is not part of the JSON specifications, the best would be to not allow
apostrophe escaping.
As an example, here is a JSON string generated by the JSON plugin :
{code}
{
    "fieldErrors": {
        "password": [
            "Password isn\'t correct"
        ]
    }
}
{code}
If you test it on http://jsonlint.com/, it says the syntax is incorrect.

Thanks.

  was:
Hello,
There is a problem with org.apache.struts2.json.JSONValidationInterceptor
This class is using StringEscapeUtils.escapeEcmaScript(String) to escape the generated JSON
string.
The problem is that StringEscapeUtils.escapeEcmaScript escapes the apostrophes. Some JSON
implementations accept the escaped apostrophes but some other don't and they are not able
to parse the JSON.
I think there should be at least an option to disable apostrophe escaping. But as I believe
escaping apostrophe is not part of the JSON specifications, the best would be to not allow
apostrophe escaping.
As an example, here is a JSON string generated by the JSON plugin :
{
    "fieldErrors": {
        "password": [
            "Password isn\'t correct"
        ]
    }
}
If you test it on http://jsonlint.com/, it says the syntax is incorrect.

Thanks.

    
> JSONValidationInterceptor and quotes in message
> -----------------------------------------------
>
>                 Key: WW-4041
>                 URL: https://issues.apache.org/jira/browse/WW-4041
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - JSON
>    Affects Versions: 2.3.14
>            Reporter: mael le guével
>            Priority: Minor
>
> Hello,
> There is a problem with org.apache.struts2.json.JSONValidationInterceptor
> This class is using StringEscapeUtils.escapeEcmaScript(String) to escape the generated
JSON string.
> The problem is that StringEscapeUtils.escapeEcmaScript escapes the apostrophes. Some
JSON implementations accept the escaped apostrophes but some other don't and they are not
able to parse the JSON.
> I think there should be at least an option to disable apostrophe escaping. But as I believe
escaping apostrophe is not part of the JSON specifications, the best would be to not allow
apostrophe escaping.
> As an example, here is a JSON string generated by the JSON plugin :
> {code}
> {
>     "fieldErrors": {
>         "password": [
>             "Password isn\'t correct"
>         ]
>     }
> }
> {code}
> If you test it on http://jsonlint.com/, it says the syntax is incorrect.
> Thanks.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message