C++ sqlite3_open_v2 function fails to open DB file when DB path has special char(ø) in it

asked 2021-11-03T11:16:47.717+00:00
Neelesh Kalani 26 Reputation points

I am trying to open a SQLite DB connection using sqlite3_open_v2 function but it fails to open the connection when DB file path has special char(ø) in it. Say something like "C:\MySøLiteDb.sqlite". Everything works fine if DB path doesn't have a special char(ø) in it.

It works with sqlite3_open16 method but then I have to change the DB encoding to UTF-16 otherwise it doesn't return any tables back.

How can I open a SQLite DB connection with sqlite3_open_v2 method when DB file path has special char in it such as ø?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
8,473 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
2,616 questions
{count} votes

Accepted answer
  1. answered 2021-11-03T11:58:12.177+00:00
    David Lowndes 4,231 Reputation points Microsoft MVP

    The API does say that the parameter should be UTF-8, so converting to that would be the obvious thing to try.
    Under Windows, the underlying API to use is WideCharToMultiByte, but depending on your source, there are several different wrappers you can use, such as AtlUnicodeToUTF8; more discussion here.


0 additional answers

Sort by: Most helpful