Skip to content
7 changes: 7 additions & 0 deletions Terminal.Gui/Drivers/AnsiDriver/AnsiOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ public AnsiOutput ()

try
{
// Ensure the console output code page is UTF-8 (65001). The ANSI driver writes
// UTF-8 encoded bytes via WriteFile; without this, a fresh Windows terminal uses
// its default OEM code page (e.g. 437), causing multi-byte UTF-8 characters
// (box-drawing glyphs, etc.) to be misinterpreted as garbled single-byte characters.
// See https://github.com/gui-cs/Terminal.Gui/issues/4848
Console.OutputEncoding = Encoding.UTF8;

// Check if we have a real console first
if (!IsAttachedToTerminal)
{
Expand Down
Loading