[jira] [Closed] (LANG-797) StringEscapeUtils.escapeJson

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] [Closed] (LANG-797) StringEscapeUtils.escapeJson

Gilles Sadowski (Jira)

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

Henri Yandell closed LANG-797.

    Resolution: Fixed

Thanks Maurizio.

svn ci -m "Added escape/unescapeJson methods per Maurizio Cucchiara's patch in LANG-797"
Sending        src/changes/changes.xml
Sending        src/main/java/org/apache/commons/lang3/StringEscapeUtils.java
Sending        src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
Transmitting file data ...
Committed revision 1467206.


> StringEscapeUtils.escapeJson
> ----------------------------
>                 Key: LANG-797
>                 URL: https://issues.apache.org/jira/browse/LANG-797
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>    Affects Versions: 2.6
>            Reporter: Joe Littlejohn
>            Priority: Minor
>              Labels: escaping, json
>         Attachments: LANG-797.patch
> It would be great to offer a StringEscapeUtils.escapeJson method which is similar to StringEscapeUtils.escapeJavaScript but will not escape apostrophe (single-quote) chars.
> The current escapeJavaScript method does escape single-quote chars, but this produces invalid JSON. A good description of the problem can be found here:
> http://stackoverflow.com/questions/2275359/jquery-single-quote-in-json-response

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