Merge pull request #74065 from RedworkDE/net-dotnet-encoding

C#: Always decode `dotnet` output as UTF-8
This commit is contained in:
Rémi Verschelde 2023-06-07 12:08:46 +02:00
commit ec999b24ee
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 18 additions and 0 deletions

View File

@ -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);

View File

@ -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<string>();