I have a dictionary of NSData values where I am passing the different values into their variables that I later use to display in tableviewcells etc.
However I have some international characters that are not displaying correctly and I would like to encode the data I am passing to a NSString but I am not sure how to do it because of the circumstances.
This is what I am currently doing.
manString = [dict valueForKey:@"MAN"];
The dict contains all of the data that i am using. any help would be appreciated
You can do this:
NSString* string = [[NSString alloc] initWithData:[dict valueForKey:@"MAN"]
encoding:NSStringEncoding];
Where encoding
should be a value from NSStringEncoding
enum, you can find it in NSString.h
, just choose encoding you need, usually it is NSUTF8StringEncoding
, but I guess not in your case.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.