Reading a plist utf-8 value as utf-16

Posted by ennuikiller on Stack Overflow See other posts from Stack Overflow or by ennuikiller
Published on 2009-05-12T15:07:22Z Indexed on 2010/04/24 18:43 UTC
Read the original article Hit count: 691

Filed under:
|
|
|

I'm working on an iphone app that needs to display superscripts and subscripts. I'm using a picker to read in data from a plist but the unicode values aren't being displayed corretly in the pickerview. Subscripts and superscripts are not being recognized. I'm assuming this is due to the encoding of the plist as utf-8, so the question is how do a convert a plist string encoding from utf-8 to utf-16 ?

Just a little more elaboration:

If I do this it displays properly at least in a textfield:

NSString *equation = @"x\u00B2 + y\u00B2 = z\u00B2"

However if I define the same string in a plist and try to read it in and assign it to a string and display it on a pickerview it just displays the the encoding and not the superscripts.

@Matt: thanks for your suggestion the unicode is being escaped that is \u00B2 => \u00B2. Googling for "escaped values in plists" returned no useful results, and I haven't been able to use the keyboard cmd-ctrl-shift-+ to work. Any further suggestions would be greatly appreciated!!

© Stack Overflow or respective owner

Related posts about iphone-sdk

Related posts about objective-c