URL编码

作者: 光明程辉 | 来源:发表于2016-10-31 00:34 被阅读37次

//原始地址
NSString *urlString = @"http://wwW.xxx.com?query= this is question";

//url编码
[urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]//ios 9+
[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]//ios9 -

//去除url编码
urlEncodeString = [urlEncodeString stringByRemovingPercentEncoding];

相关文章

网友评论

    本文标题:URL编码

    本文链接:https://www.haomeiwen.com/subject/qvguuttx.html