encodeURIComponent in Objective-C
Objective-C #
NSString *str = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(NULL, (__bridge CFStringRef)someStringToEncode, NULL, (__bridge CFStringRef)@"!*'\"();:@&=+$,/?%#[]% ", CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding)));
JavaScript #
var str = encodeURIComponent(str);