I had the right idea, but the wrong code page.

So, going from MBCS project in visual c++, there is a magic ANSI to UTF8
conversion happening when the data is stored, but not one coming back out.
I could not find a direct UTF8 to ANSI code page conversion, presumably
since they are both "multibyte", but I found a function online that would
take the string from UTF8 to back to ANSI - by routing it through an extra
conversion. (First do a MultiByteToWideChar using the UTF8 code page 65001,
then WideCharToMultiByte using the ANSI code page, 1252).  Algorithm found
at http://www.chilkatsoft.com/p/p_348.asp.

Greg

On Thu, Oct 7, 2010 at 11:22 AM, Greg Bryant <bryant...@gmail.com> wrote:

> Still hoping someone can help me with this.  I dug into it some with a hex
> editor, and it may be the app mode, which is multi-byte (and makes extensive
> use of libraries, so is not about to change).
>
> If I put the string Andé in, it is (41 6e 64 e9) in the debugger, but
> looking at the sqlite database file, it is (41 6e 64 c3 a9), with the c3
> appearing to be a UTF-8 "trigger" indicating a 2 byte characters.  So,
> somewhere along the way it went from mb to utf8, and it's just not being
> converted back out for the SELECT.  I tried a quick wide-to-multibyte
> conversion, but got real garbage then.  Next step is a manual mb to utf8
> conversion going in, but if anyone has any pointers, I'd sure love to have
> them, since I'm just guessing.
>
> Greg
>
>
> On Fri, Oct 1, 2010 at 12:51 PM, Greg Bryant <bryant...@gmail.com> wrote:
>
>> Not sure if ODBC questions belong here, feel free to point me to a better
>> forum.
>>
>> I'm using current SQLite (3.7.2) via a visual c++ app.  We're connecting a
>> sqlite3 database via ODBC (driver from , also current version - 0.87).  If I
>> do either an insert or update using an accented character (e.g. André), it
>> works fine, and I can check it using anything that directly connects to the
>> database (I've been using SQLiteStudio and SQLiteAdmin) and it looks fine.
>> When I go to do a select via the ODBC connection, however, I get back
>> garbage for the accented character (specifically, I get André).
>>
>> I don't think the app settings are a problem, since the accent works fine
>> through the insert, and step into doesn't get me past the SQLFetch from
>> Microsoft's odbc layer, and I don't think it's sqlite, since it appears to
>> be correct when viewed through a direct connection, which just leaves the
>> odbc layer.  Does anyone have any pointers on where I can look to figure
>> this out?
>>
>> Thanks,
>> Greg
>>
>
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to