akr ios
akr ios

Reputation: 611

how to display characters like ä, ö, ü, ß, Ä, Ö, Ü,é in uitableview as a textlabel

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 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

enter image description here

Upvotes: 1

Views: 1522

Answers (3)

Jhaliya - Praveen Sharma
Jhaliya - Praveen Sharma

Reputation: 31720

Use stringWithCString method to encode your NSString object in NSUTF8StringEncoding.

    NSString* myString = [NSString  stringWithCString:[specialCharConatiningString fileSystemRepresentation] encoding:NSUTF8StringEncoding]];
    myLabel.text = myString;

Upvotes: 0

smorgan
smorgan

Reputation: 21599

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.

Upvotes: 1

Praveen S
Praveen S

Reputation: 10393

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.

Upvotes: 0

Related Questions