问题描述:

I need to see some string with Unicode characters in the Xcode console when I do NSLog(@"some unicode characters.."). Eg: abc\u0001xyz\u0002pqr… But Xcode console only shows the abcxyzpqr. It doesn't show the intermediate Unicode characters. Does anyone know how to view this?

网友答案:

I know, it's a long time since you asked but try this if you're still looking for an answer :

NSString *demo=[[NSString alloc] initWithData:
                   [NSData dataWithBytes:myUnicodeString length:itsLength]
                     encoding:NSUnicodeStringEncoding];
NSLog(@"%@",demo);

Hope this help.

网友答案:
 NSString* strOld=[NSString stringWithFormat:@"%@",responseObject];
NSLog(@"%@",[NSString
             stringWithCString:[strOld cStringUsingEncoding:NSUTF8StringEncoding]
             encoding:NSNonLossyASCIIStringEncoding]);
网友答案:
 NSString *string = @"Hi \u00B7 there!";

 lblString.text=string;
相关阅读:
Top