Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QNetworkReply->request().url().toString() does not encode space in url
Forum Updated to NodeBB v4.3 + New Features

QNetworkReply->request().url().toString() does not encode space in url

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 320 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CellCS
    wrote on 19 Jan 2021, 03:02 last edited by CellCS
    #1

    GET url (1st) is like :

    https://requesturl&param=--directory%20..%2Fwork%2Fnew_rand_tables%20condition
    

    2nd: QNetworkReply->request().url().toString(): encode "=" or "/", but not space

    https://requesturl&param=--directory ..%2Fwork%2Fnew_rand_tables condition
    

    3rd: If use QUrl::toPercentEncoding(reply->url()->toString()), this will encode space , but also encode %2, so it will be

    https://requesturl&param=--directory%20..%252Fwork%252Fnew_rand_tables%20condition
    

    But this 3rd url is different from the original url (1st), i would not use 3rdUrl.replace("%25", "%").

    How to make 3rd url is the same as 1st url. (By the way, url is the key to retrieve handler).

    Thanks for comments.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bonnie
      wrote on 19 Jan 2021, 03:33 last edited by
      #2
      request().url().toString(QUrl::FullyEncoded)
      
      C 1 Reply Last reply 19 Jan 2021, 05:26
      3
      • C Offline
        C Offline
        CellCS
        wrote on 19 Jan 2021, 03:47 last edited by
        #3

        Updated, Solved by using

        reply->request().url().toString(QUrl::FullyEncoded);
        
        1 Reply Last reply
        0
        • B Bonnie
          19 Jan 2021, 03:33
          request().url().toString(QUrl::FullyEncoded)
          
          C Offline
          C Offline
          CellCS
          wrote on 19 Jan 2021, 05:26 last edited by
          #4

          @Bonnie wow, thanks a lot. Also just find this function and prove your suggestion, thanks a lot.

          1 Reply Last reply
          0

          1/4

          19 Jan 2021, 03:02

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved