views:

81

answers:

2

I have some NSString varibales that incude items like Ð and Õ and if I do

cell.textLabel.text = person.name;

and if it contains one of those characters the cell.textlabel is blank!

I have discovered that if I use

NSString *col1 = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 0)];

To pull my data back it pulls back null, however using the deprectared method

NSString *col1 = [NSString stringWithCString:(char *)sqlite3_column_text(compiledStatement, 0)];

Shows the characters!

Any ideas?

A: 

Iirc, char is a cstring, in the first sql ex you're putting UTF8 multibyte characters into single byte c string so that will be bad, null, or unpredictable.

As for putting UTF8 into a label, it can def be done since there are Asian language apps. Maybe there's a tutorial for that you can look up.

Robert maefs
This doesn't really answer the question, I know the stuff you are saying but why does the CString work and the UTF8 not? Ignore the label, when I NSLog() the col1 variable it returns (null) if those characters are anywhere in the string.
Lee Armstrong
A: 

Actually played around and got the answer!

NSString *col1 = [NSString stringWithCString:(char *)sqlite3_column_text(compiledStatement, 0) encoding:NSASCIIStringEncoding];
Lee Armstrong