NSString *urlString = GET_EVENTLIST_URL_STRING;
NSURL *url = [NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
if (!url)
{
NSString *reason = [NSString stringWithFormat:@"Could not create URL from string %@", GET_EVENTLIST_URL_STRING];
[self.delegate didGetEventListInCorrect:reason];
return;
}
// Create a mutable request because we will append data to it.
theRequest = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval: 30.0];
// Set the HTTP method of the request to POST
[theRequest setHTTPMethod:@"POST"];
if (!theRequest)
{
NSString *reason = [NSString stringWithFormat:@"Could not create URL request from string %@", GET_EVENTLIST_URL_STRING];
[self.delegate didGetEventListInCorrect:reason];
return;
}
theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
===== 大家好, 我有这个代码,这是我的字符串“EventoPúblico”,但我在输出中看到“úblico”。我也使用了NSUTF8StringEncoding但我无法管理这个?有什么想法吗?提前谢谢。