2011年1月20日 星期四

使用sqlite3存中文取出後是亂碼的解決方式

用sqlite3來存放中文或其他非英數字串 , 使用sqlite3_column_text取出後是亂碼,
解決方法:

/************************************************
取得字串後,要用stringWithUTF8String的方法轉換成NSString
***********************************************/
NSString *tmp = [NSString stringWithUTF8String:(char *)sqlite3_column_text(stmt, iCol)];

沒有留言:

張貼留言