在进行webview链接跳转的时候会遇到链接中含有中文字符,这个时候我们需要编码中文字符,
- (NSString *)encodeChineseWordForURL {
NSCharacterSet *URLParamCharacterSet;
NSMutableCharacterSet *characterSet = [NSMutableCharacterSet new];
[characterSet formUnionWithCharacterSet:[NSCharacterSet URLQueryAllowedCharacterSet]];
[characterSet addCharactersInString:@"!*'();:@&=+$,/?#[]<>\"{}|\\`^% "];
URLParamCharacterSet = [characterSet copy];
return [self stringByAddingPercentEncodingWithAllowedCharacters:URLParamCharacterSet];
}
标签: