From 504a0391c28747d0ae21b90a5cc1db904b396cac Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Fri, 27 Sep 2024 16:22:13 -0300 Subject: [PATCH] Only set UTF8 on Windows Auto-detection of encoding seems to be working fine on WSL and Linux seems to be safely on utf8 camp since long ago. --- src/Cli/Program.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Cli/Program.cs b/src/Cli/Program.cs index bf601439..674c54e6 100644 --- a/src/Cli/Program.cs +++ b/src/Cli/Program.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using System.Runtime.InteropServices; using System.Text; using Devlooped.Sponsors; using DotNetConfig; @@ -9,7 +10,10 @@ using Spectre.Console; using Spectre.Console.Cli; -Console.InputEncoding = Console.OutputEncoding = Encoding.UTF8; +// Some users reported not getting emoji on Windows, so we force UTF-8 encoding. +// This not great, but I couldn't find a better way to do it. +if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + Console.InputEncoding = Console.OutputEncoding = Encoding.UTF8; #if DEBUG if (args.Contains("--debug"))