[Qt-interest] Problem using URL with special characters
kent williams
nkwmailinglists at gmail.com
Mon Aug 29 16:08:52 CEST 2011
some things in your reply (thanks BTW) confuse me.
1. #define QT_NO_URL_CAST_FROM_STRING is a compile-time flag. Are you
suggesting that I recompile Qt with that flag, or does it somehow
affect the behavior in my code?
2. 'Never call the QUrl constructor. By definition I can't use QUrl
without calling a constructor. Are you saying to do this?
QUrl url;
url.setUrl( urlString );
3. 'use QUrl::formEncoded' -- I'm not sure what to do with this.
That's an option of QUrl::toEncoded, which returns a QByteArray, but
that isn't much use. QNetworkRequest::setUrl takes a QUrl, a
QByteArray isn't of any use to me.
The whole reason that the equals sign is encoded in the URL as %3D is
that the resulting string is meant to be passed into SQL, and
therefore shouldn't be interpreted by the web server as an = sign.
On Fri, Aug 26, 2011 at 5:38 PM, Thiago Macieira <thiago at kde.org> wrote:
> My guess is that you made the same mistake that everyone does: due to a flaw in
> QUrl's design, it's constructor is unusable. Please add this to your code:
>
> #define QT_NO_URL_CAST_FROM_STRING
>
> And make sure you never call the QUrl constructor.
>
> You want to use QUrl::formEncoded.
More information about the Qt-interest-old
mailing list