I'm having a problem when trying to urlencode a string containing an ampersand. I'm using the following code:
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
NSString *stadium = [[prefs stringForKey:@"stadiumname"]
stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
Now, the original string going in is "Brighton & Hove", which is correct when I drop it into NSLog before it gets encoded. After it's encoded, NSLog shows that it says "Brighton22ove", which is obviously failing when I pass it as a querystring.
Any suggestions?