Dealing with unicodes in strings


Graham Cox
 

I’m converting some NSData to a NSString using UTF8 encoding, which is what I believe it should be.

But the strings are sometimes ending up with embedded codes that are not converting, like @“this is a string\u002D with codes in it”

What is the proper way to deal with this? I tried the various ‘canonical’ and ‘compatibility’ mapping methods but they do nothing with this, but since I don’t really know what they do, it’s no surprise. Is there a method that will just deal with this?

—Graham

Join {cocoa@apple-dev.groups.io to automatically receive all group messages.