#define CFSTR(cStr) ((CFStringRef) __builtin___CFStringMakeConstantString ("" cStr
""))
+ (NSString *)encodeURL:(NSString *)string endcode:(NSStringEncoding)stringEncoding
{
NSString *newString = NSMakeCollectable([(NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL,
CFSTR(":/?#[]@!$ &'()*+,;=\"<>%{}|\\^~`"), CFStringConvertNSStringEncodingToEncoding(stringEncoding)) autorelease]);
if (newString) {
return newString;
}
return @"";
}
时间: 2024-10-15 23:46:40