Incorrectly escaping URL's
Opened this issue · 3 comments
Hi,
The following line of code doesn't escape all characters in URL's properly so we were having issues getting valid Embedly responses (often for links to Facebook images).
NSString *paramValue = [params[key] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
The following should be used instead:
(NSString *) CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)urlString, NULL, (CFStringRef)@";/?:@&=$+{}<>,", CFStringConvertNSStringEncodingToEncoding(NSASCIIStringEncoding)));
@tboetig @anrope @artgibson it'd be great to get this into the code base. This would be affecting all users using the iOS framework...
Hi,
Can you provide some more details? Maybe a couple example URLs that are affected by this?
Andy
Check out http://stackoverflow.com/questions/3423545/objective-c-iphone-percent-encode-a-string
stringByAddingPercentEncodingWithAllowedCharacters is the way to go as of iOS 7