C++ problems when copying text data between ActiveDirectory and Sqlite3
I wrote a C++ program to retrieve some text data from MS-Active Directory and save them into a Sqlite3 database, however I have a problem, the utf-8 encoding.

According to some readings, data from active directory is UTF-8 encoded, but when reading from C++, it treats  as a “wide char” (wchar_t) which Sqlite3 (which is utf-8 default) does not accept it as UTF-8 because it uses only “char” into the parameter of its “sqlite3_bind_text” unless I use sqlite3_bind_text16, but I do not wish to do it because it increases the size of database.

I tried to convert from "wchar_t" to "char" using the function "wcstombs_s", but resulting data are not correct.

I read that the only way would be to use MultiByteToWideChar or WideCharToMultiByte, but I didn’t give a try because I read that the cost of convertion is quite expensive.

I would like to know if anybody of you had a similar situation and found a clean and effective solution for this matter.

Many Thanks!

C++ problems when copying text data between ActiveDirectory and Sqlite3
===

I wrote a C++ program to retrieve some text data from MS-Active Directory and save them into a Sqlite3 database, however I have a problem, the utf-8 encoding.

According to some readings, data from active directory is UTF-8 encoded, but when reading from C++, it treats  as a “wide char” (wchar_t) which Sqlite3 (which is utf-8 default) does not accept it as UTF-8 because it uses only “char” into the parameter of its “sqlite3_bind_text” unless I use sqlite3_bind_text16, but I do not wish to do it because it increases the size of database.

I tried to convert from "wchar_t" to "char" using the function "wcstombs_s", but resulting data are not correct.

I read that the only way would be to use MultiByteToWideChar or WideCharToMultiByte, but I didn’t give a try because I read that the cost of convertion is quite expensive.

I would like to know if anybody of you had a similar situation and found a clean and effective solution for this matter.

Many Thanks!
