Last active
January 5, 2017 08:41
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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