Skip to content

Commit

Permalink
Only set UTF8 on Windows
Browse files Browse the repository at this point in the history
Auto-detection of encoding seems to be working fine on WSL and Linux seems to be safely on utf8 camp since long ago.
  • Loading branch information
kzu committed Sep 27, 2024
1 parent 80ee889 commit 504a039
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Cli/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
using Devlooped.Sponsors;
using DotNetConfig;
Expand All @@ -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"))
Expand Down

0 comments on commit 504a039

Please sign in to comment.