Proper way to convert char* to NSString without initWithCString?

I can see that the dash in your first log line (Retrieved Cravin Chicken Sandwich ...) isn't a simple ASCII HYPHEN-MINUS (U+002D, UTF-8 2D). It's a Unicode EN DASH character (U+2013, UTF-8 E2 80 93). Same for the second line. My guess is they're encoded incorrectly in your database. If you give -[NSString initWithUTF8String:] a C-string that's not valid UTF-8, it returns nil.

Try printing a hex dump of menuNameChars. You can do that by setting a breakpoint on the line after the call to sqlite3_column_text. When the breakpoint is reached, right-click/control-click menuNameChars in your stack frame window and choose View memory of "*menuNameChars" (note the *).


It would appear the data is not encoded as UTF-8. You should find out what encoding is being used and then use initWithCString:encoding: and pass the correct encoding.


try the power of stringWithFormat: