URL包含中文转码
2016-10-18 本文已影响80人
Liberalism
- iOS 9之前
NSString *newUrlString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
- iOS 9之后
NSString *newUrlString = [urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];