iOS 访问URL转码
-
访问URL时,需要对字符串进行转码:
urlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; -
系统会默认保留一些字符,此时若想将这些字符转换,将上述方法变为
urlStr = [urlStr stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"`#%^+{}\"[]|\\<> "].invertedSet];

浙公网安备 33010602011771号