Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-36968

JSON.parse rejects "\uXXXX" escape sequences where XXXX <= 001f

    XMLWordPrintable

Details

    Description

      The QML JSON parser rejects "\uXXXX" escape sequences where XXXX <= 001f. RFC 4627 states that any character may be escaped, including all characters in the Basic Multilingual Plane (U+0000 through U+FFFF).

      JSON.stringify() can generate data that triggers this error, for example:

      JSON.parse(JSON.stringify(["\u0007"]))
      

      The function scanEscapeSequence() in qtdeclarative/src/qml/jsruntime/qjsonobject.cpp rejects these escape sequences. The base Qt JSON parser at qtbase/src/corelib/json/qjsonparser.cpp has a slightly different version of scanEscapeSequence() that does not reject these sequences, and additionally relaxes strictness by allowing invalid escape characters.

      The base Qt JSON parser and the QML JSON parser should accept the same set of strings for consistency.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            laknoll Lars Knoll
            spencer.schumann Spencer Schumann
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes