----- Original Message ----- 
From: "Igor Tandetnik" <itandet...@mvps.org>
To: <sqlite-users@sqlite.org>
Sent: Thursday, October 29, 2009 1:45 PM
Subject: Re: [sqlite] Some clarification needed about Unicode


>
> The only Win32 API function that can handle UTF-8 strings is 
> MultiByteToWideChar (when called with CP_UTF8 flag). You should have a 
> Unicode build, where Win32 API takes UTF-16.
>
>> OR?
>>
>> [4-2a] Read with sqlite3_column_text16()
>> [4-2b] No convertion needed.
>> [4-2c] Use the result ...
>
> Yes, this should work, assuming that "use the result" part actually knows 
> how to deal with UTF-16.
>

Thanks again.

Indeed I forgot mention that I assume using a Unicode build in my app.

Also your clarification

>The result can be passed to sqlite3_bind_text16. If the database's encoding 
>is in fact UTF-8
> (determined when the database file is originally created), SQLite will 
> convert your
> string to UTF-8 automatically. If the database's encoding is UTF-16,
> the string will be inserted as-is.

>The original call to sqlite3_open{16,_v2} which created the database file 
>in the
> first place determines its encoding. After that, it doesn't matter which 
> API calls
> you use: SQLite will convert strings to the database encoding as 
> necessary.
> Pass UTF-16 strings to *16 versions of API accepting void*, UTF-8 to
> versions accepting char*.

is invaluable

A.J.Millan


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

Reply via email to