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

QXmlQuery/xs:anyUri is double percent-encoded

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Not Evaluated Not Evaluated
    • None
    • 4.7.0
    • XML: QtXmlPatterns
    • None
    • all

      The argument to the doc() function, which is an xs:anyUri, is percent-encoded when handled by Qt.
      However, since the xs:anyUri should already be in final form (the unencoded uri is typically not a valid xs:anyUri), this causes the uri to be double-encoded

      A typical XCAP uri is for example:

      http://domain/document/~~/element[@id="first"]

      which, percent-encoded, becomes

      http://domain/document/~~/element%5B@name=%22first%22%5D

      When trying to use this document however:

      fn:doc( "http://domain/document/~~/element%5B@name=%22first%22%5D" )

      the url is encoded again, resulting in .. %255Bfirst%2522%255D (i.e. the "%" themselves are encoded as "%25")

      I have checked the same XQuery with Saxon, there it does not re-encode the uri's and the query works as expected.

      IMHO the there are no special cases, any xs:anyUri used from the XQuery (for example in the doc and doc-exists functions) should simply be treated as final, when given to a QUrl, or percent-decoded first to their actual form so that QUrl re-encodes it (i.e. effectively encoded once).

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

            phartman Peter Hartmann (closed Nokia identity) (Inactive)
            dennis Dennis Noordsij
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes