[Qt-interest] Request to URL including percent

Thiago Macieira thiago.macieira at trolltech.com
Wed Dec 17 17:52:57 CET 2008


On Wednesday 17 December 2008 10:26:10 KIMURA, Hidetaka wrote:
> Thanks, but it makes a request to /a:b.
> QUrl::fromPercentEncoding also did not make a request to /a%3Ab...

%3A is a colon. QUrl in Qt 4.4 cannot hold a percent-encoded character if the 
RFC 3986 says it's not supposed to be encoded at that position.

QUrl in Qt 4.5 is now capable of holding the URL exactly as you passed it.

So, 

	QUrl u = QUrl::fromEncoded("http://example.com/a%3Ab");
	qDebug() << u.encodedPath();
	qDebug() << u.path();

will print:
	/a%3Ab
	/a:b

and:
	qDebug() << u.toEncoded();
	qDebug() << u.toString();

prints:
	http://example.com/a%3Ab
	http://example.com/a:b
-- 
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Software Engineer - Nokia, Qt Software
  Qt Software is hiring - ask me
      Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20081217/7215d7b7/attachment.bin 


More information about the Qt-interest-old mailing list