iOS HTTP URL 编码解码

发布于 2016-08-24 / iOS / 0条评论 / 2,937浏览
// 编码 `苹果`->`%E8%8B%B9%E6%9E%9C`
NSString *encode = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

// 解码  `%E8%8B%B9%E6%9E%9C`->`苹果`
NSString *decode = [urlString stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

评论
站长统计