Charith Nidarsha
Charith Nidarsha

Reputation: 4255

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?

Upvotes: 11

Views: 3222

Answers (3)

Arvind Kumar
Arvind Kumar

Reputation: 2421

 NSString *string = @"Hi \u00B7 there!";

 lblString.text=string;

Upvotes: 2

Gank
Gank

Reputation: 4667

 NSString* strOld=[NSString stringWithFormat:@"%@",responseObject];
NSLog(@"%@",[NSString
             stringWithCString:[strOld cStringUsingEncoding:NSUTF8StringEncoding]
             encoding:NSNonLossyASCIIStringEncoding]);

Upvotes: 2

fencingCode
fencingCode

Reputation: 1427

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.

Upvotes: 2

Related Questions