objective c - NSMutableDictionary with accent -
i working nsmutabledictionary , in array using words accent , add work, fine. problem retrieve , work with.
to add: [dicpt_sp setobject:@"são paulo" forkey:@"são paulo"];
when retrieving, getting: "s\u00e3o paulo"
how can solve issue? think simple, cant find solution googling. idea welcome.
i think need encode string first...this unicode string getting. need encode utf8 string this.
char cstring[] = "this isn\u2019t bike"; nsdata *data = [nsdata datawithbytes:cstring length:strlen(cstring)]; nsstring *string = [[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding]; nslog(@"result string: %@", string);
or
nsstring *input = @"\\u5404\\u500b\\u90fd"; nsstring *convertedstring = [input mutablecopy]; cfstringref transform = cfstr("any-hex/java"); cfstringtransform((__bridge cfmutablestringref)convertedstring, null, transform, yes); nslog(@"convertedstring: %@", convertedstring);
Comments
Post a Comment