CLI: Add Unicode support on Windows (#8618)

This commit is contained in:
Matthew Donoughe 2022-10-29 08:07:31 -04:00 committed by GitHub
parent 37baa6fd25
commit ab95690043
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 47 additions and 0 deletions

View file

@ -65,6 +65,9 @@ install(TARGETS keepassxc-cli
RUNTIME DESTINATION ${CLI_INSTALL_DIR} COMPONENT Runtime)
if(WIN32)
target_sources(keepassxc-cli
PRIVATE keepassxc-cli.exe.manifest)
# install(CODE "include(BundleUtilities)
# fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/keepassxc-cli.exe\" \"\" \"\")"
# COMPONENT Runtime)

View file

@ -63,6 +63,13 @@ namespace Utils
fd->open(fopen("/dev/null", "w"), QIODevice::WriteOnly);
#endif
DEVNULL.setDevice(fd);
#ifdef Q_OS_WIN
// On Windows, we ask via keepassxc-cli.exe.manifest to use UTF-8,
// but the console code-page isn't automatically changed to match.
SetConsoleCP(GetACP());
SetConsoleOutputCP(GetACP());
#endif
}
void setStdinEcho(bool enable = true)

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<application>
<windowsSettings>
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
</windowsSettings>
</application>
</assembly>