From ce9b010ec619aa6e5f19b6ae208b76a4e398b20b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 16 Aug 2012 15:31:06 +0200 Subject: Fix decoding of QByteArray in the deprecated "encoded" setters in QUrl The asymmetry is intentional: the getters can use toLatin1() because the called functions, with a QUrl::FullyEncoded parameter, return ASCII only. This gives a small performance improvement over the need to run the UTF-8 encoder. However, the data passed to setters could contain non-ASCII binary data, in addition to the percent-encoded data. We can't use fromUtf8 because it's binary and we can't use toPercentEncoded because it already encoded. Change-Id: I5ecdb49be5af51ac86fd9764eb3a6aa96385f512 Reviewed-by: David Faure --- src/corelib/io/qurl.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/corelib/io/qurl.cpp') diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 3b49b82637..cc326566c8 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -2978,6 +2978,17 @@ QByteArray QUrl::toPercentEncoding(const QString &input, const QByteArray &exclu return input.toUtf8().toPercentEncoding(exclude, include); } +/*! + \internal + \since 5.0 + Used in the setEncodedXXX compatibility functions. Converts \a ba to + QString form. +*/ +QString QUrl::fromEncodedComponent_helper(const QByteArray &ba) +{ + return qt_urlRecodeByteArray(ba); +} + /*! \fn QByteArray QUrl::toPunycode(const QString &uc) \obsolete -- cgit v1.2.3