summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2016-04-12 14:46:04 -0700
committerThiago Macieira <thiago.macieira@intel.com>2016-04-13 22:08:26 +0000
commit77fb9ca271e515f6a147d3dc7025bf3501c70fa0 (patch)
tree009e993a0e834c664e08ded6f8cf45a929ea58dd /tests/auto/corelib
parent7ab0829823024dd07d15ff6786e3648388d4f28d (diff)
Fix encoding of IDN hostnames with QUrl::host
When the formatting parameter wasn't exactly QUrl::EncodeUnicode, it wouldn't encode, despite having to. Change-Id: Id75834dab9ed466e94c7ffff1444bacc08dd109b Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index eba058a13c..ef210d4a64 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -1749,6 +1749,9 @@ void tst_QUrl::symmetry()
QUrl url(QString::fromUtf8("http://www.räksmörgås.se/pub?a=b&a=dø&a=f#vræl"));
QCOMPARE(url.scheme(), QString::fromLatin1("http"));
QCOMPARE(url.host(), QString::fromUtf8("www.räksmörgås.se"));
+ QCOMPARE(url.host(QUrl::EncodeSpaces), QString::fromUtf8("www.räksmörgås.se"));
+ QCOMPARE(url.host(QUrl::EncodeUnicode), QString::fromUtf8("www.xn--rksmrgs-5wao1o.se"));
+ QCOMPARE(url.host(QUrl::EncodeUnicode | QUrl::EncodeSpaces), QString::fromUtf8("www.xn--rksmrgs-5wao1o.se"));
QCOMPARE(url.path(), QString::fromLatin1("/pub"));
// this will be encoded ...
QCOMPARE(url.encodedQuery().constData(), QString::fromLatin1("a=b&a=d%C3%B8&a=f").toLatin1().constData());