(Objective-C きらひ)
+ (NSString *) encodeURI: (NSString *) s
{
return (__bridge_transfer NSString *)
CFURLCreateStringByAddingPercentEscapes(
kCFAllocatorDefault,
(CFStringRef) s,
NULL,
(CFStringRef) @"!*'();:@&=+$,/?%#[]",
kCFStringEncodingUTF8
);
}
+ (NSString *) decodeURI: (NSString *) s
{
return (__bridge_transfer NSString *)
CFURLCreateStringByReplacingPercentEscapes(
kCFAllocatorDefault,
(CFStringRef) s,
CFSTR("")
);
}