Skip to content

Commit

Permalink
Merge pull request #74065 from RedworkDE/net-dotnet-encoding
Browse files Browse the repository at this point in the history
C#: Always decode `dotnet` output as UTF-8
  • Loading branch information
akien-mga committed Jun 7, 2023
2 parents 828ec2c + e0efa3c commit ec999b2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ private static Process LaunchBuild(BuildInfo buildInfo, Action<string> stdOutHan
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);

Expand Down Expand Up @@ -105,6 +111,12 @@ private static Process LaunchPublish(BuildInfo buildInfo, Action<string> stdOutH
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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -58,6 +59,11 @@ public static bool TryFindDotNetSdk(
RedirectStandardOutput = true
};

if (OperatingSystem.IsWindows())
{
process.StartInfo.StandardOutputEncoding = Encoding.UTF8;
}

process.StartInfo.EnvironmentVariables["DOTNET_CLI_UI_LANGUAGE"] = "en-US";

var lines = new List<string>();
Expand Down

0 comments on commit ec999b2

Please sign in to comment.