我们使用 XML/NSMutableURLRequest 从我们的网站上提取内容,有时它会通过“卷曲”风格的撇号和引号,而不是 '。NSMutableURLRequest 似乎讨厌这些并将它们变成奇怪的 \U00e2\U0080\U0099 字符串。
我可以做些什么来防止这种情况发生吗?我正在使用 GET 方法,所以我应该以某种方式告诉它使用 UTF-8 吗?或者,我错过了什么?
UIApplication* app = [UIApplication sharedApplication];
app.networkActivityIndicatorVisible = YES;
NSString *urlStr = [NSString stringWithFormat:@"%@",url];
NSURL *serviceUrl = [NSURL URLWithString:urlStr];
NSMutableURLRequest *serviceRequest = [NSMutableURLRequest requestWithURL:serviceUrl];
[serviceRequest setHTTPMethod:@"GET"];
NSURLResponse *serviceResponse;
NSError *serviceError;
app.networkActivityIndicatorVisible = NO;
return [NSURLConnection sendSynchronousRequest:serviceRequest returningResponse:&serviceResponse error:&serviceError];