Return-Path: X-Original-To: apmail-struts-issues-archive@minotaur.apache.org Delivered-To: apmail-struts-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D27AEF0E1 for ; Tue, 9 Apr 2013 10:56:18 +0000 (UTC) Received: (qmail 57600 invoked by uid 500); 9 Apr 2013 10:56:17 -0000 Delivered-To: apmail-struts-issues-archive@struts.apache.org Received: (qmail 57473 invoked by uid 500); 9 Apr 2013 10:56:17 -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 57400 invoked by uid 99); 9 Apr 2013 10:56:17 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Apr 2013 10:56:17 +0000 Date: Tue, 9 Apr 2013 10:56:17 +0000 (UTC) From: "Maurizio Cucchiara (JIRA)" To: issues@struts.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (WW-4041) JSONValidationInterceptor and quotes in message MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/WW-4041?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:all-tabpanel ] Maurizio Cucchiara updated WW-4041: ----------------------------------- Description:=20 Hello, There is a problem with org.apache.struts2.json.JSONValidationInterceptor This class is using StringEscapeUtils.escapeEcmaScript(String) to escape th= e generated JSON string. The problem is that StringEscapeUtils.escapeEcmaScript escapes the apostrop= hes. Some JSON implementations accept the escaped apostrophes but some othe= r 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. See the original question on [the Struts User ML|http://goo.gl/WqM4f] was: Hello, There is a problem with org.apache.struts2.json.JSONValidationInterceptor This class is using StringEscapeUtils.escapeEcmaScript(String) to escape th= e generated JSON string. The problem is that StringEscapeUtils.escapeEcmaScript escapes the apostrop= hes. Some JSON implementations accept the escaped apostrophes but some othe= r 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. =20 > 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=C3=A9vel > Priority: Minor > Attachments: WW-4041-test.patch > > > 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 apostr= ophes. Some JSON implementations accept the escaped apostrophes but some ot= her 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 specificatio= ns, 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. > See the original question on [the Struts User ML|http://goo.gl/WqM4f] -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs For more information on JIRA, see: http://www.atlassian.com/software/jira