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
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…