0
NSString *cellValue = [listOfItems objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;

listOfItems is an NSMutableArray which gets values from sqlite table in the format "\u0C35\u0c36\u0C37".

When UITABLEVIEW is loaded I am seeing again same values "\u0C35\u0c36\u0C37" in the table.

But if I assign cell.textLabel.text = @"\u0C35\u0c36\u0C37", I am getting the unicode equivalent characters(I mean international characters).

Sam Saffron
  • 128,308
  • 78
  • 326
  • 506
user597677
  • 11
  • 1
  • 4

1 Answers1

0

You should load your SQLite rows using the [NSString stringWithUTF8String: ] or [NSString stringWithCString: encoding: ]

Max
  • 16,679
  • 4
  • 44
  • 57
  • You mean when inserting values into SQlite? table? or NSString *cellValue = [NSString stringWithUTF8String: [listOfItems objectAtIndex:indexPath.row]]; – user597677 Feb 01 '11 at 14:53
  • a mean when loading rows from your database into listOfItems – Max Feb 01 '11 at 15:16
  • listOfItems = dbMgr.getData; getData(){ NSString *selectSQL = [[NSString alloc] initWithFormat:@"select * from main;"];NSMutableArray* users = [[NSMutableArray alloc]init]; FMResultSet *rs = [self.db executeQuery:selectSQL]; NSLog(@"%@",selectSQL); while ([rs next]) { NSString *password = [rs stringForColumnIndex:1]; const char *utfString = [password UTF8String]; NSLog(@"%s",utfString); NSString *pwd = [NSString stringWithCString:utfString encoding:NSUTF8StringEncoding]; [users addObject:pwd]; – user597677 Feb 01 '11 at 23:06
  • const char *utfString = [password UTF8String]; NSLog(@"%s",utfString); NSString *pwd = [NSString stringWithCString:utfString encoding:NSUTF8StringEncoding]; [users addObject:pwd]; - why are you converting from NSString to char and then again to NSString? – Max Feb 01 '11 at 23:12
  • @user597677 ... please don't edit commentary into a proposed edit ... it makes my life very confusing ... http://stackoverflow.com/edit-suggestions/1414 – Sam Saffron Feb 01 '11 at 23:42
  • If i give NSString to cell.textLabel.text I am getting unicode characters ie \u0C35 so i tried to convert it to char * and assign it to label text but it is throwing error..so tried different options but ending up short. – user597677 Feb 02 '11 at 00:30
  • http://stackoverflow.com/questions/2831935/how-to-convert-unicode-strings-u00e2-etc-into-nsstring-for-display – Max Feb 02 '11 at 00:45
  • Thanks Max ..Any suggestions or 3rd party tools? – user597677 Feb 02 '11 at 01:35