我有一个这样的 NSDictionary
NSDictionary *result = [[NSDictionary alloc]
initWithObjectsAndKeys:
@"USA.png", @"США",
@"EC.png", @"ЕС",
@"Russia.png", @"Россия",
@"Brazil.png", @"Бразилия",
....... and more ......
nil];
我想通过从 XML 解析器发送字符串键 eventCountry 从这个字典中获取值。
NSString *countryImageString = [self.countrySet objectForKey:event.eventCountry];
if (countryImageString.length == 0) {
calCell.countryImageView.image = [UIImage imageNamed:@"Unknown.png"];
} else {
calCell.countryImageView.image = [UIImage imageNamed:countryImageString];
}
在 NSLog 我的 NSDictionary 看起来像
"\U0410\U0432\U0441\U0442\U0440\U0430\U043b\U0438\U044f" = "Australia.png";
"\U0410\U0432\U0441\U0442\U0440\U0438\U044f" = "Austria.png";
"\U0410\U043d\U0433\U043b\U0438\U044f" = "England.png";
"\U0410\U0440\U0433\U0435\U043d\U0442\U0438\U043d\U0430" = "Argentina.png";
"\U0411\U0435\U043b\U044c\U0433\U0438\U044f" = "Belgium.png";
"\U0411\U0440\U0430\U0437\U0438\U043b\U0438\U044f" = "Brazil.png";
但 eventCountry 是 UTF-8。如何在没有 \U0410\U0432\ 字符的情况下正确填充 plist 文件或即时转换编码?