From 170b3f0656d9c6dfc88385d0319a10be84cbb1f1 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Thu, 24 May 2012 09:35:31 -0700 Subject: [PATCH] [Issue #342] Removing URL encoding normalization --- AFNetworking/AFHTTPClient.m | 8 -------- 1 file changed, 8 deletions(-) diff --git a/AFNetworking/AFHTTPClient.m b/AFNetworking/AFHTTPClient.m index 354aa21..6f0273a 100644 --- a/AFNetworking/AFHTTPClient.m +++ b/AFNetworking/AFHTTPClient.m @@ -102,14 +102,6 @@ static NSString * AFBase64EncodedStringFromString(NSString *string) { NSString * AFURLEncodedStringFromStringWithEncoding(NSString *string, NSStringEncoding encoding) { static NSString * const kAFLegalCharactersToBeEscaped = @"?!@#$^&%*+=,:;'\"`<>()[]{}/\\|~ "; - /* - The documentation for `CFURLCreateStringByAddingPercentEscapes` suggests that one should "pre-process" URL strings with unpredictable sequences that may already contain percent escapes. However, if the string contains an unescaped sequence with '%' appearing without an escape code (such as when representing percentages like "42%"), `stringByReplacingPercentEscapesUsingEncoding` will return `nil`. Thus, the string is only unescaped if there are no invalid percent-escaped sequences. - */ - NSString *unescapedString = [string stringByReplacingPercentEscapesUsingEncoding:encoding]; - if (unescapedString) { - string = unescapedString; - } - return [(NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, (CFStringRef)kAFLegalCharactersToBeEscaped, CFStringConvertNSStringEncodingToEncoding(encoding)) autorelease]; }