【发布时间】:2014-04-10 10:56:54
【问题描述】:
这是我正在使用的代码(取自 - Converting Country Codes to Country Names)
NSLocale *locale = [NSLocale currentLocale];
NSString *countryCode = [locale objectForKey: NSLocaleCountryCode];
NSString *identifier = [NSLocale localeIdentifierFromComponents: [NSDictionary dictionaryWithObject: countryCode forKey: NSLocaleCountryCode]];
NSString *country = [[NSLocale currentLocale] displayNameForKey: NSLocaleIdentifier value: identifier];
在有英语的设备上我会得到这个:“Argentina”
但是,在使用其他语言的设备上,我会得到类似: "\U05d0\U05e8\U05d2\U05e0\U05d8\U05d9\U05e0\U05d4"
有什么想法吗?
【问题讨论】:
-
您是否将设备(或模拟器)的本地语言设置为希伯来语?
-
那个 iOS 7 字符串恰好是“ארגנטינה”(unicode 格式)。您确定两者使用相同的语言环境和语言吗?
-
我明白了...它与操作系统版本无关,但设备上的定义...如果设备使用其他语言,我如何找到英文名称?
标签: objective-c ios7 xcode5 nslocale