In my code I need to do encoding NSURL
from NSString
if string contains some special character &
in the parameters.
EX: NSString* urlText = @"70.84.58.40/projects/igolf/?TipThumb=GOLF & 58B.jpg&query=some";
Using stringByAddingPercentEscapesUsingEncoding
will not encode &
and this would be treated as some other query in url.
So, What would be correct format for encoding NSURL
from NSString
in this case.
You can use this static helper method to encode your strings for a URL: