Friday, 14 June 2013

Chinese string in the text of a UIlabel.


Try CFStringConvertEncodingToNSStringEncoding and kCFStringEncodingBig5_E.
Also see apple doc and for international or for creating own encoding see and this
unichar ellipsis = 0x2026;
NSString *theString = [NSString stringWithFormat:@"To be continued%C", ellipsis];

// custom encoding
NSStringEncoding encoding = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingDOSChineseTrad);

NSData *asciiData = [theString dataUsingEncoding:encoding 
                            allowLossyConversion:YES];

NSString *asciiString = [[NSString alloc] initWithData:asciiData 
                                              encoding:encoding];
_myLabel.text = asciiString;

No comments:

Post a Comment