瀏覽代碼

Fixes #4136. NetDriver and v2net are rendering badly the Button only in `Windows (#4137)

BDisp 3 月之前
父節點
當前提交
f3c80d99e1
共有 2 個文件被更改,包括 4 次插入3 次删除
  1. 2 3
      Terminal.Gui/Drivers/NetDriver/NetDriver.cs
  2. 2 0
      Terminal.Gui/Drivers/V2/NetOutput.cs

+ 2 - 3
Terminal.Gui/Drivers/NetDriver/NetDriver.cs

@@ -3,9 +3,6 @@
 // NetDriver.cs: The System.Console-based .NET driver, works on Windows and Unix, but is not particularly efficient.
 //
 
-using System.Collections.Concurrent;
-using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
 using System.Runtime.InteropServices;
 using static Terminal.Gui.Drivers.NetEvents;
 
@@ -232,6 +229,8 @@ internal class NetDriver : ConsoleDriver
     /// <inheritdoc />
     public override MainLoop Init ()
     {
+        Console.OutputEncoding = Encoding.UTF8;
+
         PlatformID p = Environment.OSVersion.Platform;
 
         if (p == PlatformID.Win32NT || p == PlatformID.Win32S || p == PlatformID.Win32Windows)

+ 2 - 0
Terminal.Gui/Drivers/V2/NetOutput.cs

@@ -22,6 +22,8 @@ public class NetOutput : IConsoleOutput
     {
         Logging.Logger.LogInformation ($"Creating {nameof (NetOutput)}");
 
+        Console.OutputEncoding = Encoding.UTF8;
+
         PlatformID p = Environment.OSVersion.Platform;
 
         if (p == PlatformID.Win32NT || p == PlatformID.Win32S || p == PlatformID.Win32Windows)