1
私はリモートdbからローカルsqlite3 dbにデータを格納する必要があるアプリケーションを作成しています。文字列内のユニコード文字によるアプリケーションのクラッシュ
問題がある - 任意の文字列が を挿入する際などのUnicode文字 含まれています。それはクラッシュ\ U00a0または\ U2022または\ U2019、 を。
クラッシュしたコードの一部は、this-
NSString *insertQuery = @"insert into XYZ(field1,field2) values (@"1",[recordDict objectForKey:@"field2"]);
// recordDict contains value: @"\U00a0 \U00a0 \U00a0 \U00a0The Cadfsdfsdfptain\U2019s" for key: @"field2"
sqlite3_stmt *insertStmnt;
const char *sql = [insertQuery cStringUsingEncoding:1];
printf("insertQuery - %s",sql); // it is showing insertQuery - (null) and crashing at next line
if(sqlite3_prepare_v2(database, sql, -1, &insertStmnt, NULL) != SQLITE_OK){
NSLog(@"Error while creating insert statement. '%s'",sqlite3_errmsg(database));
}
で誰がどのようにこの問題を解決するために私をお勧めすることはできますか?
おかげで、
Miraaj