I think you're making the mistake of thinking that the entire SQL string is UTF-16. Look at the API for sqlite3_prepare16_v2 SQLITE_API int sqlite3_prepare16_v2( sqlite3 *db, /* Database handle. */ const void *zSql, /* UTF-8 encoded SQL statement. */
It's your data fields that get encoded. I'm not a UTF-16 expert by any means but that's how it appears to me. I'm surprised it works in windows -- I did confirm your error on Linux. Michael D. Black Senior Scientist Northrop Grumman Mission Systems ________________________________ From: sqlite-users-boun...@sqlite.org on behalf of shion Sent: Sat 5/22/2010 7:27 AM To: sqlite-users@sqlite.org Subject: [sqlite] UTF16 - sqlite3_prepare16_v2 Hello, I already found a lot of threads about the UTF16 topic, but I couldn't solve my problem. I have the following source code: sqlite3_open_v2("test.sqlite", &Database, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0); sqlite3_exec(Database, "PRAGMA encoding = \"UTF-16\"", 0, 0, 0); sqlite3_prepare16_v2(Database, L"CREATE TABLE user (userID INTEGER NOT NULL PRIMARY KEY, lastName VARCHAR(50), firstName VARCHAR(50));", -1, &pStatement, 0); std::cout << sqlite3_errmsg(Database) << std::endl; The result is: near "C": syntax error I know that the SQL syntax is correct and it is possible to execute that source under windows. I don't understand why it doesn't work with Linux. Does somebody has an idea what's going wrong? Operating system: 2.6.31-19-generic #56-Ubuntu SMP i686 GNU/Linux IDE: NetBeans Regards, shion -- View this message in context: http://old.nabble.com/UTF16---sqlite3_prepare16_v2-tp28643020p28643020.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users