- URLFragmentAllowedCharacterSet "#%<>[\]^`{|}
- URLHostAllowedCharacterSet "#%/<>?@\^`{|}
- URLPasswordAllowedCharacterSet "#%/:<>?@[\]^`{|}
- URLPathAllowedCharacterSet "#%;<>?[\]^`{|}
- URLQueryAllowedCharacterSet "#%<>[\]^`{|}
- URLUserAllowedCharacterSet "#%/:<>?@[\]^`
stringByRemovingPercentEncoding ---- xcode7可能会提示要将stringByAddingPercentEscapesUsingEncoding替换成此方法,要根据是否是解码来区分
- let customAllowedSet = NSCharacterSet(charactersInString:"`#%^{}\"[]|\\<> ").invertedSet
- NSString *urlStr = [urlStr stringByAddingPercentEncodingWithAllowedCharacters:[[NSCharacterSet characterSetWithCharactersInString:@"?!@#$^&%*+,:;='\"`<>()[]{}/\\| "] invertedSet]];