[Interest] Difference between QUrl::fromEncoded and QUrl::fromPercentEncoding ?

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Wed Aug 14 09:23:43 CEST 2013


It seems completely understandable to me. A URL is:

>
>         URL = [scheme ":"] [authority] [path] ["?" query] ["#" fragment]
> with
>         authority = "//" [userinfo "@"] [host] [":" port]
>
> (technically, a URL cannot have an empty scheme, but a "URL reference" can,
> and QUrl parses like that)
>
> Since the input had no ":", there was no scheme. Since the input had no
> "//",
> it also had no authority. That means everything from the beginning until
> "?"
> or "#" was the path.
>
> Since there was no "?" or "#", everything in the input was parsed as path.
>

Ok. I thought the scheme, host etc was being interpreted _after_ decoding
the string.


>
> > Also, if we are getting a percent encoded 'string' from external source,
> > whats the correct way of making it into a QUrl?
>
> The URL was parsed correctly as it came. The question is why your external
> source gave you that URL which is not what you wanted it to be.
>

A Url like the one in this post is quite possible if it came as part of
another url (eg: a url encoded as a parameter).

Thanks for the clarification.

-mandeep
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130814/081d6a5d/attachment.html>


More information about the Interest mailing list