How to handle special characters from the database in objective c?

Viewed 1277

I am displaying data in the tableview cell from the sqlite database.

The data comes from xml parsing and in Hungarian language.

The data is inserted in the database very well(i.e with special characters). But at the time of fetching and displaying in the tableview , it is displayed as special characters as shown below ;

EDIT :

I have converted and inserted data in the database using follows :

 NSData *dataTitle = [articleElements.Title dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];

 NSString * stringTitle = [[NSString alloc] initWithData:dataTitle encoding:NSUTF8StringEncoding];

So in the database it is as- "Kosaras vereség hazai pályán "

but at the time of fetching from the database in the array , it is as - "Kosaras vereség hazaipályán"

I have tried like this at the time of fetching -

NSData *data = [titleLabel.text dataUsingEncoding:NSNonLossyASCIIStringEncoding];
NSString *str = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];

NSLog(@"data = %@", str);

NSString *name2 = [NSString
                   stringWithCString:[str cStringUsingEncoding:NSUTF8StringEncoding]
                   encoding:NSNonLossyASCIIStringEncoding];
NSLog(@"name2 = %@", name2);

but could not be successful.

I have searched a lot but could not be able to find the solution.

How can i do this ?

Please help me.

Thanks..

1 Answers
Related