I have tried a lot of approaches out there, but this tiny little string just cannot be URL decoded.
NSString *decoded;
NSString *encoded = @"fields=ID%2CdeviceToken";
decoded = (__bridge NSString*)CFURLCreateStringByReplacingPercentEscapesUsingEncoding(NULL, (CFStringRef)encoded, NULL, NSUTF8StringEncoding);
NSLog(@"decodedString %@", decoded);
The code above just logs the same (!) string after replacing percent escapes.
Is there a reliable solution out there? I think some kind of RegEx solution based on some documentation could work. Any suggestion?
Another option would be:
NSString *decoded = [encoded stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];