[odb-users] Open sqlite database file with unicode path in Windows

Alexander A. Prokhorov prokher at gmail.com
Fri Jul 27 05:42:28 EDT 2012


Hi Boris,

On 25.07.2012 14:38, Boris Kolpackov wrote:
> Alexander A. Prokhorov<prokher at gmail.com>  writes:
>
>> >I have some troubles opening sqlite database file which has unicode
>> >symbols in its path. As always, the problem appears only in Windows:
>> >std::exception 14: unable to open database file.
> SQLite expects the database path to be in the UTF-8 encoding (see the
> sqlite3_open() documentation for details).
>
> I guess you have the path as std::wstring or wchar_t*. I suppose this
> will be a fairly common stumbling block so maybe we should just add
> the std::wstring/wchar_t* constructor versions to odb::sqlite::database
> for Windows. Let me know if this will work for you and I will go ahead
> and add them.

We have filename in QString so methods QString::fromUtf8 and 
QString::toUtf8 have helped a lot.
I am not sure if is it necessary to add new constructor to 
odb::sqlite::database for std::wstring.
For us it would be enough to simply have a note in the documentation 
about the filename encoding.

Thanks.



More information about the odb-users mailing list