问题
Non-latin text outputs very strange way in XCode debug console. How make it right?
For example: Проверьте давление экрана.
became –ü—Ä–æ–≤–µ—Ä–∫–∞ –¥–∞–≤–ª–µ–Ω–∏—è —ç–∫—Ä–∞–Ω–∞
(Help me please improve my question because my english is not good. Let me know If it's hard to understand what I wrote here.)
- (id) initWithDictionary:(NSDictionary*)dictionary
{
//...
self.title = [dictionary objectForKey:@"Заголовок"] ; // dictionary from plist encoded in UTF8
//...
return self;
}
- (void) log
{
NSString *class = NSStringFromClass([self class]);
NSString *sel = NSStringFromSelector(_cmd);
NSLog(@"%@:%@:%@", class, title_, sel);
}
title_
is iVar NSString loaded from plist. It's used as title of uiviewcontroller and works fine on iPhone & iPad.
回答1:
Since I changed debugger from lldb to gdb output had become OK. So, something wrong must be with lldb.
In xcode 4: Menu -> Product -> Manage Schemes... Then tap Edit button -> Run Your.app (Left panel) -> Debugger -> change it from LLDB to GDB.
回答2:
I thought this wouldn't be a problem as of Xcode 3 but I guess I thought wrong.
Ugly trick for logging: Maybe try NSString's -cStringUsingEncoding: with different logging format to try to force the correct encoding to be displayed. I don't know if this will work:
NSLog(@"%S", [title_ cStringUsingEncoding:NSUnicodeStringEncoding]);
来源:https://stackoverflow.com/questions/10950805/debugger-console-encoding-in-xcode-is-broken