开发者

read a plist generated with iso-8859-1

I have created a plist using .net environment and after the creation I set the encoding type as "iso-8859-1" in the plist encoding type. Then I tried to read it and show in the table view开发者_StackOverflow社区. The values are not as expected.

It is having few characters which are of incorrect encoding type.

What should I do ?


You could try to load the file as an NSString, which you could specify an encoding.

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

and then use the -propertyList method to convert the string into a plist.

id plist = [plistString propertyList];

But it is better to ensure you always generate UTF-8/UTF-16 on the C# side.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜