Open aleblanc70 opened 6 years ago
Correct me if I am wrong but this is what I came up so far:
Since SQLite-net use sqlite3_open
and sqlite3_open_v2
here and here and based on the doc, §1,2, SQLite creates database with UTF-8 encoding by default. If you want to modify that behaviour, you have to use PRAGMA
at the very creation of the database. You CAN NOT modify the encoding once the database is created. Consider that once the first table is created, the database is created as well (The Definitive Guide to SQLite: Database Configuration from SO).
To change the encoding, get a SQLiteConnection
(the Async
version is also valid) and call Execute(@"PRAGMA encoding = ""UTF-XX""")
where XX
is the UTF version you want to use as per the PRAGMA
specifications. Be sure this call is done before any CreateTable
This method is valid for any permanent form of PRAGMA
. Use Execute
or ExecuteScalar<>
if the PRAGMA
is returning something you want to use.
Hope this helps.
How can I make sure my string columns support utf8 or 16. I'm using sqlite with Xamarin.Forms and we need to support chiness, russian japan etc. Regarding my first name André on my pdf report I loose my é
Does SQLite is utf-8 by default for text ? Some doc. say to add an encoding parameter in the connection string to support it but I don't see the option with this implementation.