Re: Dealing with unicodes in strings


Glenn L. Austin
 

Is it possible that the code "\u002D" is in the string as the six characters? It is just the minus sign, but could the source have encoded certain characters so they wouldn't be accidentally interpreted?

-- 
Glenn L. Austin, Computer Wizard and Race Car Driver         <><
<http://www.austinsoft.com>

On May 31, 2019, at 6:09 AM, Graham Cox <graham@...> wrote:

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.