According to documentation of NSURLComponents
:
If you set the unencoded property, you can then obtain the encoded equivalent by reading the encoded property value and vice versa.
I tried to get the percent encoding versions of the query and path of the url but I miss something:
NSURL * url = [NSURL URLWithString:@"http://google.com"];
NSURLComponents * components = [[NSURLComponents alloc] initWithURL:url resolvingAgainstBaseURL:YES];
components.query = @"oauth_callback=http://google.com";
NSLog(@"Encoded: %@", [components URL]);
//-> Encoded: http://google.com?oauth_callback=http://google.com
//Does not encode "/" or ":"
Where do I fail ?
I think
NSURLComponent
's behaviour is right. From Wikipedia: