I am having the toughest time encoding a URL that contains a query string.
What I want to do is open a webbrowser control to a URL. I've done this several times before with no problems. Only difference this time - the URL has a query string on the end.
http://my.host.com/path?address=123 Main Street
Now, of course, "123 Main Street" needs to be encoded first. This is where I am having the trouble.
The following example code illustrates my problem:
I would expect the output to be "123%20main%20St". But instead, the output is garbage.
Can anyone tell me why this is? Is this a bug?
What I want to do is open a webbrowser control to a URL. I've done this several times before with no problems. Only difference this time - the URL has a query string on the end.
http://my.host.com/path?address=123 Main Street
Now, of course, "123 Main Street" needs to be encoded first. This is where I am having the trouble.
The following example code illustrates my problem:
Code:
NSString *myUrl = [@"123 main St" stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSLog(myUrl);
I would expect the output to be "123%20main%20St". But instead, the output is garbage.
Can anyone tell me why this is? Is this a bug?