一般转码直接用stringByAddingPercentEscapesUsingEncoding就能解决,但是当url中包含符号之类的情况,后台需要接受类似这样的url时。就需要特殊的转码了
http://open.weixin.qq.com/connect/oauth2/authorize?appid=wx0f8d672b71fd9a3f&redirect_uri=http://91md.cc/doctest/trunk/html/askformskip.html?id=235&docId=00000000f82f09a9077a476aab20e5f00edb4fb9
解决办法
#define SHARDURL [NSString stringWithFormat:@"http://91md.cc/doctest/trunk/html/askformskip.html?id=%@&docId=%@",askFormId,userId]
NSString * utfStr = (__bridge_transfer NSString*) CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (__bridge CFStringRef)SHARDURL, NULL, (__bridge CFStringRef)@"!*'();:@&=+$,/?%#[]", kCFStringEncodingUTF8 );
转载请注明原文地址: https://ju.6miu.com/read-676165.html