[aString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; //ç‰ä»·äºŽ [aString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"`#%^{}\"[]|\\<> "]];
字符集
URLHostAllowedCharacterSet "#%/<>?@\^`{|} URLFragmentAllowedCharacterSet "#%<>[\]^`{|} URLPasswordAllowedCharacterSet "#%/:<>?@[\]^`{|} URLPathAllowedCharacterSet "#%;<>?[\]^`{|} URLQueryAllowedCharacterSet "#%<>[\]^`{|} URLUserAllowedCharacterSet "#%/:<>?@[\]^`