Ariel,

At 02:38 18/12/2016, you wrote:

Hi people. I need some help I’m lost here.
I’m writing an application using SQLite and whenever I insert Spanish characters
I get this kind of strings:
Mart�n (where it should read ‘Martín’)

Ok, so if I open my database with SQLiteManager (the Firefox addin) my strings look weird like that. But SQLiteManager is able to insert and display any string correctly. And any string inserted by SQLiteManager displays all right in my app as well.

So I must be doing something wrong when I insert the strings. This is my code:

Note: szSQL is the wchar-string my app uses

    char szAux[2048];
    ZeroMemory(szAux, 2048);
WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, szSQL, wcslen(szSQL), szAux, 2048, NULL, 0);

    int nRet= sqlite3_exec(m_hDB, szAux, NULL, 0, &pErrMsg);


SQLiteManager tells me that my db is utf-16le. Im using vs2015 in a Windows10 64bit machine.

Since your DB is UTF-16LE encoded, you shouldn't convert your strings to UTF8.

int nRet= sqlite3_exec(m_hDB, szSQL, NULL, 0, &pErrMsg);

alone should work fine.

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

Reply via email to