用于百分比转义“&"的 NSString 方法网址 [英] NSString method to percent escape '&' for URL

查看:24
本文介绍了用于百分比转义“&"的 NSString 方法网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪种 NSString 编码方法可以将与符号 (&) 字符正确转义为 %26?

Which NSString encoding method will percent escape the ampersand (&) character correctly into %26?

stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding

获取空格 (%20) 和其他坏人但忽略 & 符号!?!

gets the spaces (%20) and other baddies but ignores ampersands!?!

推荐答案

与号不会被该方法处理,因为它们是 URL 中的合法字符.在此调用之前,您可能应该对特别有问题的部分进行零碎的预处理.

Ampersands won't be processed by that method because they're legal characters in a URL. You should probably pre-process particularly problematic pieces, piecemeal, prior to this call.

这篇关于用于百分比转义“&"的 NSString 方法网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆