On 2/28/07, Pavan <[EMAIL PROTECTED]> wrote:
>But I'm thinking you really want to do this anyway:

Well, I have a requirement to store/retrieve UTF16 strings.  The current
discussion thread
is based on that.  Pls let me know if my understanding of using
sqlite3_open16 is correct
to store and retrieve utf16 strings.

A sqlite database stores text as UTF-8 text, by default, meaning you
can use any sqlite UTF-16 function to retrieve and/or store UNICODE
data, even on a database no open using sqlite3_open16().

The only difference is that if you use sqlite3_open16 to create a new
database, internally the database will store text as UTF-16, instead
of UTF-8, but to the user, the result will be exactly the same.

As Dan pointed out, creating a database using sqlite3_open16() is
exactly the same as using sqlite3_open() followed by executing
"PRAGMA encoding=UTF-16", but all functions, having or not the "16"
suffix will return exactly the same data, though with different
encodings.

If you need to get UTF-16 strings, you have 2 options: either use the
UTF-8 sqlite functions and latter convert to UTF-16 or use the UTF-16
functions, but the data in the database is the same.

It depends on your application what makes more sense to you. On Linix,
UTF-8 makes more sense than UTF-16 because wchar_t can't be used to
store UTF-16 strings, while on windows, you can just use wchar_t
strings and call the UTF-16 functions.

You decide what it's better...

Regards,
~Nuno Lucas

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to