Results 1 to 4 of 4

Thread: Is this a bug in QUrl toEncoded function?

  1. #1
    Join Date
    May 2011
    Posts
    46
    Thanks
    5

    Default Is this a bug in QUrl toEncoded function?

    QString str = "svn://myrepo/Templates/Visual Studio/ItemTemplates/Visual C#/";
    QUrl url(str);
    QString result = url.toEncoded();

    The resulting value is:
    "svn://myrepo/Templates/Visual%20Studio/ItemTemplates/Visual%20C#/"

    // where '#' should really be encoded as '%23'

  2. #2
    Join Date
    May 2011
    Posts
    239
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60
    Thanks
    4
    Thanked 35 Times in 35 Posts

    Default Re: Is this a bug in QUrl toEncoded function?

    It would be a bug if that method claimed to percent-encode all reserved characters defined in RFC 3986. But it doesn't. It promises only do this:

    "The user info, path and fragment are all converted to UTF-8, and all non-ASCII characters are then percent encoded. The host name is encoded using Punycode."

  3. #3
    Join Date
    Nov 2010
    Posts
    315
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanked 53 Times in 51 Posts

    Default Re: Is this a bug in QUrl toEncoded function?

    use QUrl::toPercentEncoding to resolve the problem. use include parameter to enforce encoding of character you think have to be encoded.

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

    Default Re: Is this a bug in QUrl toEncoded function?

    '#' is a perfectly good character in URLs.
    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.


Similar Threads

  1. QUrl and https
    By TomASS in forum Newbie
    Replies: 1
    Last Post: 15th March 2010, 23:49
  2. QUrl and EUC-JP
    By Ignacio Serantes in forum Qt Programming
    Replies: 1
    Last Post: 22nd February 2009, 16:19
  3. QUrl broke?
    By bwindorski in forum Qt Programming
    Replies: 3
    Last Post: 26th January 2009, 21:16
  4. [QUrl] Auto-Login
    By debmag in forum Qt Programming
    Replies: 2
    Last Post: 23rd October 2008, 07:41
  5. QUrl parsing?
    By gfunk in forum Qt Programming
    Replies: 2
    Last Post: 17th January 2008, 11:51

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
  •  
Qt is a trademark of The Qt Company.