diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp index 3fcd9299f39..e4d2663f7a5 100644 --- a/src/network/kernel/qnetworkproxy_mac.cpp +++ b/src/network/kernel/qnetworkproxy_mac.cpp @@ -203,6 +203,15 @@ void proxyAutoConfigCallback(void *client, CFArrayRef proxylist, CFErrorRef erro info->proxies = proxylist; } } + +QCFType stringByAddingPercentEscapes(CFStringRef originalPath) +{ + Q_ASSERT(originalPath); + const auto qtPath = QString::fromCFString(originalPath); + const auto escaped = QString::fromUtf8(QUrl::toPercentEncoding(qtPath)); + return escaped.toCFString(); +} + } // anon namespace QList macQueryInternal(const QNetworkProxyQuery &query) @@ -228,9 +237,7 @@ QList macQueryInternal(const QNetworkProxyQuery &query) // kSCPropNetProxiesProxyAutoConfigURLString returns the URL string // as entered in the system proxy configuration dialog CFStringRef pacLocationSetting = (CFStringRef)CFDictionaryGetValue(dict, kSCPropNetProxiesProxyAutoConfigURLString); - QCFType cfPacLocation = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, pacLocationSetting, NULL, NULL, - kCFStringEncodingUTF8); - + auto cfPacLocation = stringByAddingPercentEscapes(pacLocationSetting); QCFType pacData; QCFType pacUrl = CFURLCreateWithString(kCFAllocatorDefault, cfPacLocation, NULL); if (!pacUrl) {