I have stored the name called Désirée Allenspach in sqlite DB as a varchar.When I read this into a NSString
variable to display in UITableView
as a开发者_JAVA百科 textlabel
//cell.textLabel.text = name;
It is not dispalyed as it is supposed to be.
I want to display it as Désirée Allenspach only without adding any extra character. Please help me
What encoding are you using to store it in the database, and what encoding are you using to read it back out? You don't say what the problem is exactly, but assuming it's that you have garbage characters where the accents are, it's almost certainly an encoding issue at the storage layer, not a problem with your cell.
You can display unicode characters using the unicode key for them
[label setText:[NSString stringWithFormat:@"%@", @"\u221e"]];
sets the text for infinity.
Here you can get the list of unicode strings.
Use stringWithCString
method to encode your NSString
object in NSUTF8StringEncoding
.
NSString* myString = [NSString stringWithCString:[specialCharConatiningString fileSystemRepresentation] encoding:NSUTF8StringEncoding]];
myLabel.text = myString;
精彩评论