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