Reputation: 1367
I need to print Ñ to screen. I'm using this code and it works fine for everything but the capital Ñ. It displays this: √ë.
CGContextShowText(textContext, [text UTF8String], strlen([text UTF8String]));
And, all these encodings give the same thing:
const char *cn = "Ñ";
NSLog(@"%@", [NSString stringWithUTF8String: cn]);
NSLog(@"%C", 0x00d1);
NSLog(@"%@", @"Ñ");
2012-06-20 16:27:09.388 app[406:707] Ñ
2012-06-20 16:27:09.392 app[406:707] Ñ
2012-06-20 16:27:09.394 app[406:707] Ñ
So, how do I display Ñ and not √ë, using NSLog or CGContextShowText?
Upvotes: 0
Views: 159
Reputation: 27073
The following works properly on my Mac:
NSLog(@"%@", [NSString stringWithUTF8String:"Ñ"]);
Make sure the text encoding has been set correctly in Xcode:
Upvotes: 1