A.J.Millan wrote: > Really, here you touched tangentially the core of my question. Besides all > those great theories, at last I have UTF-8 encoded data in a dBase, and the > UCS-2 encoded data of the MS Win32 API (w_chars in muy Cpp app). The > question is: What is the concrete way to and from that w_chars to the UTF-8 > that need SQLite? (my guess is use UTF-8 to the stored data) Can I use > wcstombs() or even WideCharToMultiByte()? -this last seem a nightmare to > me-.
Not wcstombs - it uses system default codepage, and that is never UTF-8. You can use WideCharToMultiByte(CP_UTF8) - I don't quite see why you find it so offensive. You can use a third-party library if you are so inclined, e.g. ICU. You can roll your own - a conversion between UTF-8 and UTF-16 is pretty straightforward. Or, you can simply use SQLite's 16-bit API (e.g. sqlite3_bind_text16) and have it convert to UTF-8 for you automatically. > Really, preventing future possible problems, my textual data was stored as > blob. The idea is rebuild converting from 8 bits ASCII to UTF-8. Then the > question: can be done with mbstowcs() prior to using sqlite3_bind_text()? You probably mean sqlite3_bind_text16. Yes, you can use mbstowcs, assuming your system code page matches the one used when the data was originally inserted. Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users