Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I want to program my own Eng-Rus dictionary with personalised entries. Studying the topic I wrote this method (in the purpose of learning) - and I cannot output the NSMutableDictionary in Russian TO CONSOLE. Look at the code and the console output. I've tried to disable LLDB to GDB with no luck. The encoding pref is UTF8 (xcode 4.6.3). So, I think I have a "programmer" issue - i.e I just don't know something. I still learning, so need your help, friends...

-(NSString*) dicto
{
    NSString *vic;
    NSMutableDictionary *dictos = [[NSMutableDictionary alloc]initWithCapacity:10] ;

    [dictos setValue:@"кошка" forKey:@"cat"]; //at the console output below NO Russian
    [dictos setValue:@"dog" forKey:@"собака"]; //at the console output below NO Russian

    NSArray *final=[dictos allKeys];
    id vid =[final objectAtIndex:1];
    NSLog(@"vid is %@",vid); // prints in Russian
    NSLog(@"%@", dictos); //this line probably has an issue  
    vic=vid;
    return vic; //the label.text in sender (=iphone simulator) prints Russian   
}

Console Output (lower window in XCode)

2013-08-04 23:20:33.958 helloWorldToConsolFromNSLog[17718:c07] vid is собака
2013-08-04 23:20:33.958 helloWorldToConsolFromNSLog[17718:c07] {
    cat = "U043aU043eU0448U043aU0430";
    "U0441U043eU0431U0430U043aU0430" = dog;
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
532 views
Welcome To Ask or Share your Answers For Others

1 Answer

NSLog uses the description method for printing an NSDictionary (or NSArray), and that prints all non-ASCII characters in the Unnnn escaped form.

NSLog and description should only be used for debugging output, so this no problem at all. All keys and values are stored correctly.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...