-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
I encountered an error when fetching data for artists with ampersands in their name, like "Simon & Garfunkel"
The ampersand needs to be url endcoded or the artist named will be concatenated, in this case returning details for "Simon".
I added the following function, originally found at http://deusty.blogspot.com/2006/11/sending-http-get-and-post-from-cocoa.html
- (NSString *)urlEncodeValue:(NSString *)str
{
NSString *result = (NSString *) CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)str, NULL, CFSTR("?=&+"), kCFStringEncodingUTF8);
return [result autorelease];
}
and adjusted generatePOSTBodyFromDictionary as follows
[rawBody appendString:[NSString stringWithFormat:@"&%@=%@", key, [self urlEncodeValue:[dict objectForKey:key]]]];
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels