Re: Dealing with unicodes in strings


Graham Cox
 

OK, makes sense. A simple NSString category using NSScanner internally makes it easy enough.

Thanks for the help,

—Graham

On 1 Jun 2019, at 1:18 pm, Jens Alfke <jens@...> wrote:

Those are JavaScript escape sequences. If you’re reading raw JS string literals out of the page, you need to decode all the escapes, which are like the C ones plus \uxxxx.

This isn’t anything to do with NSString; NSJSONSerialization could probably decode it since JSON string syntax is based on JS.

—Jens


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