NSString *urlencode(NSString *str){ CFStringEncoding cfEncoding = kCFStringEncodingUTF8; str = (__bridge NSString *)CFURLCreateStringByAddingPercentEscapes( NULL, (CFStringRef)str, NULL, CFSTR("!*'();:@&=+$,/?%#[]"), cfEncoding ); return str; } NSString *urldecode(NSString *str){ CFStringEncoding cfEncoding = kCFStringEncodingUTF8; str = (__bridge NSString *)CFURLCreateStringByReplacingPercentEscapesUsingEncoding ( NULL, (CFStringRef)str, CFSTR(""), cfEncoding ); return str; }
2015-04-08
Objective C urlencode urldecode
Views: 9203 |
Add Comments