读取用iso-8859-1生成的plist

时间:2010-09-11 15:39:23

标签: iphone encoding plist iso-8859-1

我使用.net环境创建了一个plist,在创建之后,我在plist编码类型中将编码类型设置为“iso-8859-1”。然后我试着阅读它并在表格视图中显示。值不符合预期。

字符很少,编码类型不正确。

我该怎么办?

1 个答案:

答案 0 :(得分:0)

您可以尝试将文件加载为NSString,您可以指定编码。

NSString* plistString = [NSString stringWithContentsOfURL:...
                                                 encoding:NSISOLatin1StringEncoding 
                                                    error:NULL];

然后使用the -propertyList method将字符串转换为plist。

id plist = [plistString propertyList];

但最好确保始终在C#端生成UTF-8 / UTF-16。