From 77fb9ca271e515f6a147d3dc7025bf3501c70fa0 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 12 Apr 2016 14:46:04 -0700 Subject: 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 Reviewed-by: Edward Welbourne --- tests/auto/corelib/io/qurl/tst_qurl.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/auto/corelib/io/qurl/tst_qurl.cpp') 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()); -- cgit v1.2.3