I have a URL string (NSString) with spaces and & characters. How do I url encode the entire string (including the & ampersand
NSString
&
-(NSString *)encodeUrlString:(NSString *)string { return CFBridgingRelease( CFURLCreateStringByAddingPercentEscapes( kCFAllocatorDefault, (__bridge CFStringRef)string, NULL, CFSTR("!*'();:@&=+$,/?%#[]"), kCFStringEncodingUTF8) ); }
according to the following blog