The encoding pragma controls how strings are
encoded and stored in a database file. Any string value that is
recorded to the database is first re-encoded into this
format.
The
value can be one of format
'UTF-8', 'UTF-16le', or 'UTF-16be'. Additionally, if the value 'UTF-16' is given, either
'UTF-16le' or 'UTF-16be' will be used, as
determined by the native endian of the processor. Any version of
SQLite running on any platform should be able to read a database
file, regardless of the encoding.
The encoding can only be set on the
main database, and only
before the database is initialized. All attached databases must
have the same encoding as the main database. If ATTACH is used to create a new database, it
will automatically inherit the encoding of the main database. If the main database has not been
initialized when ATTACH is
run, it will automatically be initialized with the current
default values before the ATTACH command is allowed to run.