On 2/1/15, Peter Haworth <p...@lcsql.com> wrote:
> I'm new to the unicode world so this question may not make sense.
>
> The "PRAGMA encoding" statement tells me the encoding of a database. Can I
> rely on all data in the database having that encoding? For example, if the
> encoding is UTF8 and a row is inserted containing UTF16 encoded data, will
> it still end up as UTF8 data in the database?
>

If the database encoding is UTF8 and you insert data using
sqlite3_bind_text16() or a similar function, then SQLite automatically
converts UTF16 to UTF8.  Likewise, if you extract data using
sqlite3_column_text16() or a similar routine, then the UTF8 to UTF16
conversion is automatic.

If you run an INSERT statement that has the data as part of the INSERT
statement itself (not normally recommended due to the risk of SQL
injection if you fail to properly escape the data) then any necessary
conversions are also automatic.

-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to