From f6c5452d97c5bc53fd29c32e7f9bee0f5e411283 Mon Sep 17 00:00:00 2001 From: Indrajit Tapadar Date: Wed, 23 Jan 2013 13:08:20 +0100 Subject: Fix for url encoding in QDesktopServices::openUrl(). URLs containing spaces (encoded) couldnt be opened using QDesktopServices::openUrl() -method. This is a regression as it works for 4.8, Using url.toEncoded() instead of url.toString() which removed percent encoding. The NSUrl uses RFC 2396 for parsing, and according to the documentation, of 2.4. Escape Sequences - Data must be escaped if it does not have a representation using an unreserved character; And as a space does not have a representation using unreserved character it needs to be escaped. Example: Using this url, http://www.google.com/search?q=testme%20withspace url.toString() returns "http://www.google.com/search?q=testme withspace" and url.toEncoded() returns, http://www.google.com/search?q=testme%20withspace" which is also the expected result. Task-number: QTBUG-29124 Change-Id: Ieed3d4cfb689b9311f6cf21e5098a1e70256ab03 Reviewed-by: Thiago Macieira --- src/plugins/platforms/cocoa/qcocoaservices.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoaservices.mm b/src/plugins/platforms/cocoa/qcocoaservices.mm index dea23e7e53..e4cec8c5f8 100644 --- a/src/plugins/platforms/cocoa/qcocoaservices.mm +++ b/src/plugins/platforms/cocoa/qcocoaservices.mm @@ -55,7 +55,7 @@ bool QCocoaServices::openUrl(const QUrl &url) const QString scheme = url.scheme(); if (scheme.isEmpty()) return openDocument(url); - return [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:QT_PREPEND_NAMESPACE(QCFString::toNSString)(url.toString())]]; + return [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:QT_PREPEND_NAMESPACE(QCFString::toNSString)(url.toString(QUrl::FullyEncoded))]]; } bool QCocoaServices::openDocument(const QUrl &url) -- cgit v1.2.3