I have a UITextView
which I call messageField
. The data within that messageField
is POST
-ed to server in JSON format. When th
Thanks @Karu, editing your response,I use this code:
Encode for send to server:
NSString *uniText = [NSString stringWithUTF8String:[text_to_send UTF8String]];
NSData *msgData = [uniText dataUsingEncoding:NSNonLossyASCIIStringEncoding];
NSString *str = [[NSString alloc] initWithData:msgData encoding:NSUTF8StringEncoding];
Decode to receive and showing emoji text:
NSData *newdata = [received_string dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
NSString *mystring = [[NSString alloc] initWithData:newdata encoding:NSNonLossyASCIIStringEncoding];
NSString *finalString= @"";
if (mystring) {
finalString = mystring;
}else{
finalString = received_string;
}
This code run perfect on iOS 9