[Qt-interest] Problem using URL with special characters

Thiago Macieira thiago at kde.org
Mon Aug 29 16:29:35 CEST 2011


On Monday, 29 de August de 2011 09:08:52 kent williams wrote:
> 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?

Recompile your code with that flag. You'll catch misuses of the QUrl 
constructor.

> 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 );

The QUrl::setUrl method has the same problem. Don't ever use it.

> 3. 'use QUrl::formEncoded' -- I'm not sure what to do with this.

    QUrl::fromEncoded("http://example.com");

> 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.

See above.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110829/1975bcd2/attachment.bin 


More information about the Qt-interest-old mailing list