- 9.0以前
NSString *urlSreing = @"www.baidu.com";
NSString *unicodeStr = (NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)urlString, NULL, NULL, kCFStringEncodingUTF8));
- 9.0开始
NSString *unicodeStr = [urlString stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet];