First of all, I found this: Objective C HTML escape/unescape, but it doesn\'t work for me.
My encoded characters (come from a RSS feed, btw) look like this: &a
If you have the Character Entity Reference as a string, e.g. @"2318"
, you can extract a recoded NSString with the correct unicode character using strtoul
;
NSString *unicodePoint = @"2318"
unichar iconChar = (unichar) strtoul(unicodePoint.UTF8String, NULL, 16);
NSString *recoded = [NSString stringWithFormat:@"%C", iconChar];
NSLog(@"recoded: %@", recoded");
// prints out "recoded: ⌘"