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?
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.
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.
Go to Xcode → Preferences → Debugging → On Start → "Show Console".
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.
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]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With