Hi Jens,

> If you're coding against the 'standard' Win32 APIs, Windows will send
> you the strings in the character encoding specified by the either
> the  System or the current user settings. This has nothing to do with
> unicode. However, for many roman characters, the standard Windows
> code pages and UTF-8 have a fair amount of overlap, so you can get
> away just passing those strings to sqlite3_open() for ASCII names and
> _some_ localized names, but in general, this won't work if the
> filename is not pure ASCII.
>
> If you can't use the Win32 unicode APIs (in which case you'd call
> sqlite3_open16), you'll need to make sure you convert from the
> Windows encoding to UTF-8 before passing the filenames.
> Unfortunately, I don't know enough details about the Windows APIs to
> tell you exactly how to do this :(  You'll have to look up on MSDN -
> searching for "MultiByteToWideChar" might get you started...
> (I'm lucky enough to code on Mac OS X, where filenames are generally
> passed in UTF-8 ;-)

Thanks for the clarification. This information got me to the right
direction. I have found the "MultiByteToWideChar" function. It does what I
need. But instead of making conversions I decided to use the "IsTextUnicode"
function (I didn't know that one either) which provides far more information
about the string. If it returns true then I can safely (I suppose) use the
sqlite3_open16 to open the database. In my tests it worked perfectly, but I
guess the best way to really test this is asking some of our users to do so.
;-)

Thanks a lot for your time and help on this. You really helped me a lot.

Best Regards,

COS

Reply via email to