crino / instagram-ios-sdk

Instagram SDK for iOS
http://www.followgram.me
228 stars 63 forks source link

Printing Instagram photo captions with emoji unicode characters #7

Closed markdorison closed 11 years ago

markdorison commented 11 years ago

I am attempting to consume and then print out an Instagram photo caption that contains emoji. The caption text returned in the dictionary looks like the following

text = "Sample comment. \Uf4f1";

I attempt to set an NSString equal to this value with the following line

NSString *caption = [NSString stringWithUTF8String:[[[igPhotoDict objectForKey:@"caption"] objectForKey:@"text"] UTF8String]]

The NSString then contains the following:

Sample comment. 

What is the proper way to handle this string containing unicode emoji characters?

crino commented 11 years ago

mmm never tried before anyway seems you need to convert the emoji code from the new Unicode 6.0 to 'old' Softbank PUA characters

http://opensource.apple.com/source/ICU/ICU-461.13/icuSources/data/translit/Any_SoftbankSMS.txt

Let me know ;)