How to pass an BIG5 chinese characters in objective-c

纵然是瞬间 提交于 2019-12-24 09:36:57

问题


I want to pass an Chinese characters (BIG5) in NSURLConnection in my request but it shows an error

Domain=NSURLErrorDomain Code=-1000 "bad URL" UserInfo=0xa17a750 {NSUnderlyingError=0xa17ffa0 "bad URL", NSLocalizedDescription=bad URL}

回答1:


You should escape your string by using -[NSString stringByAddingPercentEscapesUsingEncoding:] method before using it in URL. And I suspect you should also convert your big5 string to utf8 before escaping.

EDIT:

To use BIG5 you can use this:

NSStringEncoding big5 = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingBig5);


来源:https://stackoverflow.com/questions/17715644/how-to-pass-an-big5-chinese-characters-in-objective-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!