Reputation: 200
This is my code
for(id tempLangItem in jp.staffData)
{
NSMutableDictionary *temp=[[NSMutableDictionary alloc] initWithDictionary:tempLangItem];
NSString *name = [temp objectForKey:@"lang_name"];
NSLog(@"item_name =%@",name);
NSLog(@"value in dictionary=%@",temp);
}
These are log details
item_name =marinieres
value_in_dictionary={
"lang_id" = 2;
"lang_name" = "\U7a46\U840a\U65afmarinieres";
time = "2013-06-05 05:14:50";
}
why it is giving lang_name=\U7a46\U840a\U65afmarinieres
in value_in_dictionary
logs while it is displaying correct in item_name
log.
Upvotes: 0
Views: 61
Reputation: 20021
Tried
NSMutableDictionary *temp=[[NSMutableDictionary alloc]init];
[temp setObject:@"marinieres" forKey:@"lang_name"];
NSString *name = [temp objectForKey:@"lang_name"];
NSLog(@"item_name =%@",name);
NSLog(@"value in dictionary=%@",temp);
and what my log shows
2013-06-06 12:38:02.337 Cool[96423:11303] item_name =marinieres
2013-06-06 12:38:04.022 Cool[96423:11303] value in dictionary={
"lang_name" = marinieres;
}
1 Quick question: if it is an NSDictionary why you creating a new instance?
NSMutableDictionary *temp=[[NSMutableDictionary alloc] initWithDictionary:tempLangItem];
try with tempLangItem
Upvotes: 2