07-21-2023, 06:16 PM
In iOS8 and prior I can use:
NSString *str = ...; // some URL
NSString *result = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
in iOS9 `stringByAddingPercentEscapesUsingEncoding` has been replaced with `stringByAddingPercentEncodingWithAllowedCharacters`:
NSString *str = ...; // some URL
NSCharacterSet *set = ???; // where to find set for NSUTF8StringEncoding?
NSString *result = [str stringByAddingPercentEncodingWithAllowedCharacters:set];
and my question is: where to find needed `NSCharacterSet` (`NSUTF8StringEncoding`) for proper replacement of `stringByAddingPercentEscapesUsingEncoding`?
NSString *str = ...; // some URL
NSString *result = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
in iOS9 `stringByAddingPercentEscapesUsingEncoding` has been replaced with `stringByAddingPercentEncodingWithAllowedCharacters`:
NSString *str = ...; // some URL
NSCharacterSet *set = ???; // where to find set for NSUTF8StringEncoding?
NSString *result = [str stringByAddingPercentEncodingWithAllowedCharacters:set];
and my question is: where to find needed `NSCharacterSet` (`NSUTF8StringEncoding`) for proper replacement of `stringByAddingPercentEscapesUsingEncoding`?