ASIHTTPRequest Url 请求转码

来源:互联网 发布:佣兵天下的java游戏 编辑:程序博客网 时间:2024/05/01 13:53

// 参数带中文的字符串
NSString *urlString = [NSString stringWithFormat:@"http://localhost:8080/Test/WeiboRequestServlet?test=%@",@"测试"];


// 对该字符串进行UTF-8转码
urlString= [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
// 发送请求
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:urlString]];
[request startAsynchronous];

原创粉丝点击