Yes, they are obscure, but that is the whole point of supporting
Unicode. Because users want to enter obscure characters into your
application ;)

My main point is that you can't take the UTF-16 string and safely supply
it to APIs which want UCS-2 encoded text, such as Win32 APIs (including
things like SetWindowText()). Odds are that the only library you are
using which supports UTF-16 is SQLite. You should always be converting
the text to UCS-2 before you use it.

John

-----Original Message-----
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Dan Kennedy
Sent: Thursday, October 29, 2009 6:39 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Some clarification needed about Unicode


On Oct 29, 2009, at 4:41 PM, Jean-Christophe Deschamps wrote:

>
>> [1] Supposing some textual data already inserted as UTF-8 (default
>> mode) in
>> a dBase, and a connection opened with sqlite3_open(): Does a
>> sqlite3_column_text16 retrieves a correct UTF-16 content? Is to  
>> say, do
>> SQLite the convertion internally?
>>
>> [2] Assuming the previous -or a UTF-16 content obtained by any other
>> means-
>> and an develop using M$ VCpp for Windows32, say sizeof(w_char) == 2:
>> can be
>> used the UTF-16 content to directly fill an w_char string?
>
> Yes and yes, hopefully!

Yes and yes it is.

Of course, some unicode codepoints are encoded to 4 bytes using utf-16,
they will span 2 of the entries in the array of w_char variables. I
think (never checked though), that they are pretty obscure characters.

Dan.


> SQLite handles all necessary conversions and produces UTF-16 with
> native endianness, whatever encoding was used at database creation.
>
>
>
> _______________________________________________
> 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
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to