一般情況下針對(duì)于URL轉(zhuǎn)碼:
[url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
但是對(duì)于含有特殊字符的就需要字符集轉(zhuǎn)碼:
url = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"#%<>[\\]^`{|}\"]+"].invertedSet];