I am using three20\'s URL navigator and I want to create a map as follows:
[map from:[Group class] name:@\"show\" toURL:@\"tt://group/(gid)/(name)\"];
- (NSString *)encodedURLString {
NSString *result = (NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,(CFStringRef)self,
NULL,
CFSTR("?=&+"),
kCFStringEncodingUTF8); // encoding
return [result autorelease];
}
- (NSString *)encodedURLParameterString {
NSString *result = (NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
(CFStringRef)self,
NULL,
CFSTR(":/=,!$&'()*+;[]@#?"),
kCFStringEncodingUTF8);
return [result autorelease];
}
You can start with
NSURL *url = [NSURL URLWithString:@"http://www.google.com"];
to get the url from the NSString.
Also, see here about URLencoding it with the proper escapes.