Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mikeabdullah
Last active January 5, 2017 08:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeabdullah/cc7bcb8a352a7ece98da to your computer and use it in GitHub Desktop.
Save mikeabdullah/cc7bcb8a352a7ece98da to your computer and use it in GitHub Desktop.
Decoding URL query items for schemes where + is to be treated as a space
NSURLComponents *components = [NSURLComponents componentsWithString:input];
// Re-encode + symbols so NSURLQueryItem recognises them as spaces
components.percentEncodedQuery = [components.percentEncodedQuery
stringByReplacingOccurrencesOfString:@"+"
withString:@"%20"];
NSArray *items = components.queryItems;
// Enumerate and handle the items
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment