summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qdataurl.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2011-09-08 22:06:17 +0200
committerQt by Nokia <qt-info@nokia.com>2012-03-30 01:19:59 +0200
commit1372d60bde04a31c8036601076d1093a67c6bd46 (patch)
tree77aebb9ffe2dd37ec619d484e02a4a04e1bbc033 /src/corelib/io/qdataurl.cpp
parent4758c8fa486c07e12e6d0eebfd7b5f8b07b49654 (diff)
Long live the new QUrl implementation.
Also say hello to QUrl's constructor and QUrl::toString being allowed again. QUrl operates now on UTF-16 encoded data, where a Unicode character matches its UTF-8 percent-encoded form (as per RFC 3987). The data may exist in different levels of encoding, but it is always in encoded form (a percent is always "%25"). For that reason, the previously dangerous methods are no longer dangerous. The QUrl parser is much more lenient now. Instead of blindly following the grammar from RFC 3986, we try to use common-sense. Hopefully, this will also mean the code is faster. It also operates on QStrings and, for the common case, will not perform any memory allocations it doesn't keep (i.e., it allocates only for the data that is stored in QUrlPrivate). The Null/Empty behaviour that fragments and queries had in Qt4 are now extended to the scheme, username, password and host parts. This means QUrl can remember the difference between "http://@example.com" and "http://example.com". Missing from this commit: - more unit tests, for the new functionality - the implementation of the StrictMode parser - errorString() support - normalisation Change-Id: I6d340b19c1a11b98a48145152513ffec58fb3fe3 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/corelib/io/qdataurl.cpp')
-rw-r--r--src/corelib/io/qdataurl.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/corelib/io/qdataurl.cpp b/src/corelib/io/qdataurl.cpp
index 8002f10889..600f650bb5 100644
--- a/src/corelib/io/qdataurl.cpp
+++ b/src/corelib/io/qdataurl.cpp
@@ -61,11 +61,8 @@ Q_CORE_EXPORT bool qDecodeDataUrl(const QUrl &uri, QString &mimeType, QByteArray
// the following would have been the correct thing, but
// reality often differs from the specification. People have
// data: URIs with ? and #
- //QByteArray data = QByteArray::fromPercentEncoding(uri.encodedPath());
- QByteArray data = QByteArray::fromPercentEncoding(uri.toEncoded());
-
- // remove the data: scheme
- data.remove(0, 5);
+ //QByteArray data = QByteArray::fromPercentEncoding(uri.path(QUrl::PrettyDecoded).toLatin1());
+ QByteArray data = QByteArray::fromPercentEncoding(uri.url(QUrl::PrettyDecoded | QUrl::RemoveScheme).toLatin1());
// parse it:
int pos = data.indexOf(',');