iOs - Url encode
2 minuti di lettura
The stringByAddingPercentEscapesUsingEncoding function doesn't translate all characters for URL encoding.
To encode all characters I use the CFURLCreateStringByAddingPercentEscapes function as follow:
To encode all characters I use the CFURLCreateStringByAddingPercentEscapes function as follow:
- (NSString*) encodeUrlString:(NSString*)unencodedString {
return (NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,(CFStringRef)unencodedString,NULL,(CFStringRef)@"!*'\"();:@&=+$,/?%#[]% ", kCFStringEncodingUTF8 );
}
Dalla stessa categoria
Cool buttons in ASP.NET
2 minuti di lettura