Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View Unicode characters in Xcode console?

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?

like image 661
Charith Nidarsha Avatar asked Jul 30 '10 13:07

Charith Nidarsha


People also ask

How do I display Unicode?

Inserting Unicode characters To insert a Unicode character, type the character code, press ALT, and then press X. For example, to type a dollar symbol ($), type 0024, press ALT, and then press X.

How do I check if a char is Unicode?

Check the length of the string and size in bytes. If both are equal then it ASCII. If size in bytes is larger than length of the string, then it contains UNICODE characters.

How do I check my Xcode console?

Go to Xcode → Preferences → Debugging → On Start → "Show Console".

What characters are in Unicode?

Unicode covers all the characters for all the writing systems of the world, modern and ancient. It also includes technical symbols, punctuations, and many other characters used in writing text.


2 Answers

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.

like image 110
fencingCode Avatar answered Oct 20 '22 00:10

fencingCode


 NSString* strOld=[NSString stringWithFormat:@"%@",responseObject];
NSLog(@"%@",[NSString
             stringWithCString:[strOld cStringUsingEncoding:NSUTF8StringEncoding]
             encoding:NSNonLossyASCIIStringEncoding]);
like image 36
Gank Avatar answered Oct 20 '22 01:10

Gank