From e0efa3c3577795d5b5dbeef6e35b9fd74e61aa3d Mon Sep 17 00:00:00 2001 From: RedworkDE <10944644+RedworkDE@users.noreply.github.com> Date: Mon, 27 Feb 2023 15:11:51 +0100 Subject: [PATCH] C#: Always decode `dotnet` output as UTF-8 --- .../GodotTools/GodotTools/Build/BuildSystem.cs | 12 ++++++++++++ .../GodotTools/GodotTools/Build/DotNetFinder.cs | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs index d550c36b82d..d7d484d166a 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs @@ -41,6 +41,12 @@ namespace GodotTools.Build startInfo.EnvironmentVariables["DOTNET_CLI_UI_LANGUAGE"] = ((string)editorSettings.GetSetting("interface/editor/editor_language")).Replace('_', '-'); + if (OperatingSystem.IsWindows()) + { + startInfo.StandardOutputEncoding = Encoding.UTF8; + startInfo.StandardErrorEncoding = Encoding.UTF8; + } + // Needed when running from Developer Command Prompt for VS RemovePlatformVariable(startInfo.EnvironmentVariables); @@ -105,6 +111,12 @@ namespace GodotTools.Build startInfo.EnvironmentVariables["DOTNET_CLI_UI_LANGUAGE"] = ((string)editorSettings.GetSetting("interface/editor/editor_language")).Replace('_', '-'); + if (OperatingSystem.IsWindows()) + { + startInfo.StandardOutputEncoding = Encoding.UTF8; + startInfo.StandardErrorEncoding = Encoding.UTF8; + } + // Needed when running from Developer Command Prompt for VS RemovePlatformVariable(startInfo.EnvironmentVariables); diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/DotNetFinder.cs b/modules/mono/editor/GodotTools/GodotTools/Build/DotNetFinder.cs index b437c7e742f..cfe79cf3e1f 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/DotNetFinder.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/DotNetFinder.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Runtime.InteropServices; +using System.Text; using JetBrains.Annotations; using OS = GodotTools.Utils.OS; @@ -58,6 +59,11 @@ namespace GodotTools.Build RedirectStandardOutput = true }; + if (OperatingSystem.IsWindows()) + { + process.StartInfo.StandardOutputEncoding = Encoding.UTF8; + } + process.StartInfo.EnvironmentVariables["DOTNET_CLI_UI_LANGUAGE"] = "en-US"; var lines = new List();