From 2b9dcad5b7e8742ddb270dd3c37cbb503529632d Mon Sep 17 00:00:00 2001 From: dream-young-soul <337918198@qq.com> Date: Fri, 24 Feb 2023 15:23:33 +0800 Subject: [PATCH] Set .net compilation output stream to utf8 Set the .net compilation output stream to utf8 to prevent garbled characters in other languages. --- .../mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs | 2 ++ .../mono/editor/GodotTools/GodotTools/Build/DotNetFinder.cs | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs index d550c36b82da..b3d9226c6ac5 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs @@ -38,6 +38,7 @@ private static Process LaunchBuild(BuildInfo buildInfo, Action stdOutHan startInfo.RedirectStandardError = true; startInfo.UseShellExecute = false; startInfo.CreateNoWindow = true; + startInfo.StandardOutputEncoding = Encoding.UTF8; startInfo.EnvironmentVariables["DOTNET_CLI_UI_LANGUAGE"] = ((string)editorSettings.GetSetting("interface/editor/editor_language")).Replace('_', '-'); @@ -102,6 +103,7 @@ private static Process LaunchPublish(BuildInfo buildInfo, Action stdOutH startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardError = true; startInfo.UseShellExecute = false; + startInfo.StandardOutputEncoding = Encoding.UTF8; startInfo.EnvironmentVariables["DOTNET_CLI_UI_LANGUAGE"] = ((string)editorSettings.GetSetting("interface/editor/editor_language")).Replace('_', '-'); diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/DotNetFinder.cs b/modules/mono/editor/GodotTools/GodotTools/Build/DotNetFinder.cs index b437c7e742fd..6c4c45c5a49c 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.CodeAnalysis; using System.IO; using System.Runtime.InteropServices; +using System.Text; using JetBrains.Annotations; using OS = GodotTools.Utils.OS; @@ -55,7 +56,8 @@ public static bool TryFindDotNetSdk( process.StartInfo = new ProcessStartInfo(dotNetExe, "--list-sdks") { UseShellExecute = false, - RedirectStandardOutput = true + RedirectStandardOutput = true, + StandardOutputEncoding = Encoding.UTF8, }; process.StartInfo.EnvironmentVariables["DOTNET_CLI_UI_LANGUAGE"] = "en-US";