Description
Overview
When calling keepassxc-cli.exe on Windows it changes the code page to 65001.
And when calling powershell.exe, the font changes from Consolas to Raster Fonts.
Version 2.7.3 is OK, but versions 2.7.4 and later change the code page and the console font.
Steps to Reproduce
- Open Command Prompt.
- Set console font to Consolas, size 16.
- Type:
powershell.exe dir C:\Windows\System32\cmd.exe
- Console font doesn't change.
- Type:
"C:\Program Files\KeePassXC\keepassxc-cli.exe" -v
- Console font doesn't change.
- Type:
powershell.exe dir C:\Windows\System32\cmd.exe
- Console font changes to Raster Fonts, size 8x12.
Expected Behavior
Console font does not change.
Actual Behavior
Console font changes from Consolas, size 16 to Raster Fonts, size 8x12.
Context
Default code page is 850, not 437.
The chcp.com
command returns 850.
The Command Prompt font is set to Consolas, size 16.
KeePassXC - 2.7.4 and later
Operating System: Windows
Additional info when running inside PowerShell.
# Compile a helper type that calls the WinAPI functions.
Add-Type -Namespace Util -Name WinApi -MemberDefinition @'
[DllImport("Kernel32.dll")]
public static extern uint GetACP();
[DllImport("Kernel32.dll")]
public static extern uint GetOEMCP();
[DllImport("Kernel32.dll")]
public static extern uint GetConsoleCP();
[DllImport("Kernel32.dll")]
public static extern uint GetConsoleOutputCP();
'@
[Util.WinAPI]::GetACP() # Returns 1252
[Util.WinAPI]::GetOEMCP() # Returns 850
[Util.WinAPI]::GetConsoleCP() # Returns 850
[Util.WinAPI]::GetConsoleOutputCP() # Returns 850
& 'C:\Program Files\KeePassXC\keepassxc-cli.exe' -v # Returns 2.7.9
[Util.WinAPI]::GetACP() # Returns 1252
[Util.WinAPI]::GetOEMCP() # Returns 850
[Util.WinAPI]::GetConsoleCP() # Returns 65001
[Util.WinAPI]::GetConsoleOutputCP() # Returns 850
Metadata
Assignees
Type
Projects
Status
Done
Activity
droidmonkey commentedon Nov 13, 2024
The default code page is 437 when I launch a fresh command prompt. I do not observe any font changes from within Terminal, but I do observe that from the legacy command prompt.
CLI: Restore the original codepage on windows
smru commentedon Nov 14, 2024
Steps to Reproduce on fresh Windows 10 Enterprise 22H2 installation.
chcp
and press Enter. It returns 437.powershell.exe dir C:\Windows\System32\cmd.exe
and press Enter. Console font does not change.chcp
and press Enter. It returns 437.chcp
and press Enter. It returns 65001.powershell.exe dir C:\Windows\System32\cmd.exe
and press Enter. Console font changes to Raster Fonts.When opening a new Command Prompt and changing the console font from Consolas to Lucida Console.
and trying to reproduce the issue, the code page does change to 65001, but the font remains Lucida Console.
phoerious commentedon Nov 16, 2024
This is so we can display passwords with non-ASCII characters. See #3050.
CLI: Restore the original codepage on windows
3 remaining items