1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-18 00:54:19 +00:00

Added code to properly escape non-ascii characters in URLs passed to the WebBrowserComponent on macOS/iOS

This commit is contained in:
hogliux 2017-01-12 15:27:35 +00:00
parent a554d0e95e
commit 1baaddb115

View file

@ -231,8 +231,15 @@ public:
}
else
{
NSString* urlString = juceStringToNS (url);
#if (JUCE_MAC && (defined (__MAC_OS_X_VERSION_MIN_REQUIRED) && defined (__MAC_10_9) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_9)) || (JUCE_IOS && (defined (__IPHONE_OS_VERSION_MIN_REQUIRED) && defined (__IPHONE_7_0) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_0))
urlString = [urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
#else
urlString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
#endif
NSMutableURLRequest* r
= [NSMutableURLRequest requestWithURL: [NSURL URLWithString: juceStringToNS (url)]
= [NSMutableURLRequest requestWithURL: [NSURL URLWithString: urlString]
cachePolicy: NSURLRequestUseProtocolCachePolicy
timeoutInterval: 30.0];