iOS处理含中文的请求链接

时间:2022-10-21 18:19:38

 

NSString *urlStr = @"";

// 将中文URL进行转码

urlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

NSURL *url = [NSURL URLWithString:urlStr];