I have a string which ends with percent sign(%),
this string is prepared for an URL request as a parameter:
NSString *parameter = @"/param=%";
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL urlWithString:[NSString stringWithFormat:@"http://www.whatev%@",parameter]]];
The request returns nil
.
I've tried:
NSString *parameter = @"/param=\uFF05";
//request returns nil
and
NSString *parameter = @"/param=%";
NSString *newParameter = [parameter stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
//request returns /param=%25 ...where does 25 come from?!
How could I have only one % converted to a request url?
Any advice would be appreciated.