Browse Source

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

tags/2021-05-28
hogliux 9 years ago
parent
commit
1baaddb115
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm

+ 8
- 1
modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm 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];


Loading…
Cancel
Save