URL特殊字符编码

在url中utf8时除了中文外,!*'();:@&=+$,/?%#[]也做了utf8StringEncoding编码,比如http:shengshui.com/#/id 编码后http://shengshui.com/%23/id 在进行访问时路径就不对

1.url编码  [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 

API_DEPRECATED(“Use -stringByAddingPercentEncodingWithAllowedCharacters: instead, which always uses the recommended UTF-8 encoding, and which encodes for a specific URL component or subcomponent since each URL component or subcomponent has different rules for what characters are valid.”, macos(10.0,10.11), ios(2.0,9.0), watchos(2.0,2.0), tvos(9.0,9.0));

?  解决这个问题,正则表达式去修改这个:

发表回复

电子邮件地址不会被公开。 必填项已用*标注