开发者

Arabic UTF Encoding to Percent Encoding in NSURL

am working on some mobile apps that send requests from mobile to internet via Http Requests

the problem is that i send Arabic chars in this requests as parameters so i have to convert them from

UTF-8 to Percent Encoding

i have a java based solution here :

http://mrxprt.com/blog/?p=454

[at the b开发者_如何学编程ottom of post u will find English Details : ]

but my problem now with Objective-C , how can it be done ?!


Try either

NSString *result =[sourceString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

or

NSString *result =(NSString *)CFURLCreateStringByAddingPercentEscapes(NULL,
                                                               (CFStringRef)sourceString,
                                                               NULL,
                                                               (CFStringRef)@"!*'\"();:@&=+$,/?%#[]% ",
                                                               CFStringConvertNSStringEncodingToEncoding(encoding));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜