SQLite Forum

[BUG] Precompiled sqlite shell for windows can't open filenames with unicode chars
Login
> chcp 65001

This advice is a distraction. It changes the code page of the *current* Windows console, which means it can't affect the default, as you'd need for your particular use case, where the console isn't even up yet when the problem occurs: during program launch.

There are ways to change the Windows console's default code page, but it'll probably break all your other apps that assume UTF-16, so it's bad advice across the board.

It's a solution to a different problem anyway. It would allow output in the `sqlite3` shell to show up in the console properly, and it would let you type input that gets sent to the shell as UTF-8. It isn't going to change how `sqlite3` interprets file names in its `argv`.

Now, if you wanted to get involved and start working on fixing such problems yourself, that'd be different, though in this particular case, I think you'd end up with a fork of SQLite rather than getting your fixes for this sort of problem into SQLite proper.

----

I called this `chcp` stuff a distraction, because the core problems go much deeper.

On Windows 10 with all the toys, it *still* doesn't work as you want, and it's not entirely SQLite's fault.

I copied your Chinese database name from your forum post to the clipboard and induced SQLite to create a database of that name with a basic schema inside so I could tell when I'd opened it successfully. I ran into a whole series of failures along the way:

1. Drag file into stock `cmd.exe` window: garbage text that doesn't work even when attempted.
2. Drag file into `cmd.exe` window after `chcp 65001`. Ditto.
3. Drag file into same window already running `sqlite3.exe`. Ditto.
4. Give up and try all of the above with PowerShell: `DIR` shows mangled file name. Attempting to use it anyway either crashes `sqlite3` or creates a new DB with an incorrect file name.
5. Install [Windows Terminal][1]. Now the name shows up properly in `DIR` under PowerShell, but the native `sqlite3` still can't open it due to the non-UTF-8 `argv` problem called out above. At least now we've stripped away all of the non-SQLite parts of the problem, so success?
6. Try Ubuntu-on-WSL in Windows Terminal. Now we're getting somewhere. `ls` shows the file name properly and copy-pasting it into SQLite commands works. I can even copy the first character and use Tab-completion to fill in the rest of the name, which means if I could write Chinese, I could type that first character instead and use Tab completion. Not that this helps you, since WSL and Windows Terminal both require Windows 10, but it shows success is in principle *possible* under Windows.
7. Or not. Drag file name to Windows Terminal; it refuses. [Known bug, scheduled for a fix in 2.0][2], which is currently "24% complete" according to GitHub, scheduled for release by May 31, 2021. We'll see.

**EDIT:** Per knu's [deleted reply][3], I then tried this on a Windows XP test VM I have, and it still doesn't work, even with `chcp 65001`. The feature's there, but it doesn't help, essentially for the reasons given above, though there's additional brokenness atop it that's since been fixed in later versions of Windows.

Always remember people, Windows is the easy operating system, the one that gives people the least problems. 🙄

----

**tl;dr:** Install Linux on the system and be happy. :)


[1]: https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701
[2]: https://github.com/microsoft/terminal/issues/7754
[3]: https://sqlite.org/forum/forumpost/da23e11181?hist