Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-797

StringEscapeUtils.escapeJson

    XMLWordPrintableJSON

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6
    • Fix Version/s: None
    • Component/s: lang.*
    • Labels:

      Description

      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

        Attachments

        1. LANG-797.patch
          7 kB
          Maurizio Cucchiara

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                japher Joe Littlejohn
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: