diff --git a/mac/Keyman4MacIM/Keyman4MacIM/KMInputMethodAppDelegate.m b/mac/Keyman4MacIM/Keyman4MacIM/KMInputMethodAppDelegate.m index 8dc3b8a356..6355ddc008 100644 --- a/mac/Keyman4MacIM/Keyman4MacIM/KMInputMethodAppDelegate.m +++ b/mac/Keyman4MacIM/Keyman4MacIM/KMInputMethodAppDelegate.m @@ -91,8 +91,17 @@ typedef enum { NSUInteger index = NSNotFound; if ((index = [value rangeOfString:@"filename="].location) != NSNotFound) _downloadFilename = [NSString stringWithString:[value substringFromIndex:index+9]]; - else if ((index = [value rangeOfString:@"url="].location) != NSNotFound) - downloadUrl = [NSURL URLWithString:[[NSString stringWithString:[value substringFromIndex:index+4]] stringByRemovingPercentEncoding]]; + else if ((index = [value rangeOfString:@"url="].location) != NSNotFound) { + NSString *urlString = [NSString stringWithString:[value substringFromIndex:index+4]]; + @try { + urlString = [urlString stringByRemovingPercentEncoding]; + } + @catch (NSException *e) { + // Must be an OS version prior to 10.9 - try this (now deprecated) method instead: + urlString = [urlString stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + } + downloadUrl = [NSURL URLWithString:urlString]; + } } if (downloadUrl && _downloadFilename) {