Results 1 to 4 of 4

Thread: strange output using topercentencoding()

  1. #1
    Join Date
    Apr 2011
    Location
    Hyderabad, India
    Posts
    25
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default strange output using topercentencoding()

    pls check th below code n its strange output...i m not able to figure it out

    QString params = QString("q=%1&fields=%2")
    .arg(QByteArray("mimeType='application/json'").toPercentEncoding().data())
    .arg(QByteArray("items").toPercentEncoding().data( ));

    Output:
    q=mimeType%3D%27applicationitemsFjson%27&fields=it ems

    why items coming just after application...wat happened to '/' percent encoded part. If i remove '/' then output is fine.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: strange output using topercentencoding()

    And what is so strange here? "/" expands to %2F and thus "%2" gets expanded to the second argument given.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2011
    Location
    Hyderabad, India
    Posts
    25
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: strange output using topercentencoding()

    thanks wysota for the explanation...
    so wats the remedy...hw do i form the string so tat strings in arg() only get percent encoded.


    Added after 10 minutes:


    but in first arg() single quote ' getting encoded to %27 but its not expanding to second argument...
    Last edited by raj_iv; 5th December 2012 at 06:45.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: strange output using topercentencoding()

    Quote Originally Posted by raj_iv View Post
    thanks wysota for the explanation...
    so wats the remedy...
    The remedy is to replace the percents later or to not use arg().

    but in first arg() single quote ' getting encoded to %27 but its not expanding to second argument...
    Maybe it'd be expanded to 27th argument.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    raj_iv (5th December 2012)

Similar Threads

  1. Replies: 1
    Last Post: 20th July 2012, 11:46
  2. Replies: 3
    Last Post: 27th August 2011, 21:44
  3. Replies: 8
    Last Post: 27th September 2010, 14:10
  4. Strange output: Can't compile for WinCE to save my life!
    By codeslicer in forum Qt Programming
    Replies: 3
    Last Post: 20th February 2010, 14:55
  5. output UTF?
    By mikro in forum Newbie
    Replies: 4
    Last Post: 18th May 2006, 23:00

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.