美文网首页
utf-8 转码--网址转码

utf-8 转码--网址转码

作者: 九天环佩 | 来源:发表于2016-07-14 15:36 被阅读25次

NSString *name = @"联通测试";
NSString *utfName = [name stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]];
NSString *tempName = [utfName stringByRemovingPercentEncoding];

打印:utf:%E8%81%94%E9%80%9A%E6%B5%8B%E8%AF%95 temp:联通测试

相关文章

网友评论

      本文标题:utf-8 转码--网址转码

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