i have a url with some “special” characters in it like quotes.
When i try this:
NSURL *url = [NSURL URLWithString:@"http://someurl/%22sometext%22"];
the url is null.
When i try this:
NSURL *url = [NSURL URLWithString:[@"http://someurl/%22sometext%22" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
i geht a horrible output like this:
{type = 15, string = http://someurl/%22sometext%22, encoding = 134217984, base = (null)}
Can anybody help me please?
Don’t encode it yourself before.. e.g.
NSURL *url = [NSURL URLWithString: [@"http://someurl/\"sometext\"" stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];is working.But for proper URL Encoding use other functions: