Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set .net compilation output stream to utf8 #73861

Closed
wants to merge 9 commits into from
Closed

Set .net compilation output stream to utf8 #73861

wants to merge 9 commits into from

Conversation

dream-young-soul
Copy link

Set the .net compilation output stream to utf8 to prevent garbled characters in other languages

20230224145959

Set the .net compilation output stream to utf8 to prevent garbled characters in other languages
@dream-young-soul dream-young-soul requested a review from a team as a code owner February 24, 2023 07:26
@@ -50,7 +50,7 @@ public static class BuildSystem
process.OutputDataReceived += (_, e) => stdOutHandler.Invoke(e.Data);
if (stdErrHandler != null)
process.ErrorDataReceived += (_, e) => stdErrHandler.Invoke(e.Data);

process.StartInfo.StandardOutputEncoding = Encoding.UTF8;
Copy link
Member

@akien-mga akien-mga Feb 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be better defined together with other startInfo properties before it's passed to the Process constructor:

startInfo.RedirectStandardOutput = true;
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('_', '-');

Same for the other one below.

@@ -61,7 +62,7 @@ public static string FindDotNetExe()
process.StartInfo.EnvironmentVariables["DOTNET_CLI_UI_LANGUAGE"] = "en-US";

var lines = new List<string>();

process.StartInfo.StandardOutputEncoding = Encoding.UTF8;
Copy link
Member

@akien-mga akien-mga Feb 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as for the other file, define this directly in the ProcessStartInfo constructor instead of setting it up after the fact and between the definition and use of lines.

using Process process = new Process();
process.StartInfo = new ProcessStartInfo(dotNetExe, "--list-sdks")
{
    UseShellExecute = false,
    RedirectStandardOutput = true,
    StandardOutputEncoding = Encoding.UTF8
};

@akien-mga
Copy link
Member

Could you squash the commits? And make sure to use the more explicit commit message for the squashed commit (like "Set .NET compilation output stream to UTF-8". See PR workflow for instructions.

@dream-young-soul
Copy link
Author

你能压缩提交吗?并确保为压缩的提交使用更明确的提交消息(例如“将 .NET 编译输出流设置为 UTF-8”。有关说明,请参阅PR 工作流程。

OK, I'll give it a try. This is my first PR submission. Many processes do not understand

@akien-mga
Copy link
Member

akien-mga commented Feb 24, 2023

Let me know if you need help. I can also update the PR myself, but if you're interested it's a good opportunity to learn Godot's PR workflow and some Git tricks.

Set the .net compilation output stream to utf8 to prevent garbled characters in other languages
Set the .net compilation output stream to utf8 to prevent garbled characters in other languages
@dream-young-soul
Copy link
Author

Let me know if you need help. I can also update the PR myself, but if you're interested it's a good opportunity to learn Godot's PR workflow and some Git tricks.

I changed the code and tried to merge, was it successful?

@akien-mga
Copy link
Member

After squashing the commits, you should actually have force pushed (git push --force) instead of merging your remote master branch back into the local one. Now there are 5 commits when there should be one.

Here's a branch with the commits squashed and a couple unnecessary formatting changes removed:
https://github.com/akien-mga/godot/tree/dream-young-soul/dotnet-process-startinfo-utf8

Set the .net compilation output stream to utf8 to prevent garbled characters in other languages

.net build_log utf8

Set the .net compilation output stream to utf8 to prevent garbled characters in other languages

Set .net compilation output stream to utf8

Set .net compilation output stream to utf8

Set the .net compilation output stream to utf8 to prevent garbled characters in other languages
Set the .net compilation output stream to utf8 to prevent garbled characters in other languages

.net build_log utf8

Set the .net compilation output stream to utf8 to prevent garbled characters in other languages

Set .net compilation output stream to utf8

Set .net compilation output stream to utf8

Set the .net compilation output stream to utf8 to prevent garbled characters in other languages

.net build_log utf8

Set the .net compilation output stream to utf8 to prevent garbled characters in other languages

Set .net compilation output stream to utf8
@dream-young-soul
Copy link
Author

After squashing the commits, you should actually have force pushed (git push --force) instead of merging your remote master branch back into the local one. Now there are 5 commits when there should be one.

Here's a branch with the commits squashed and a couple unnecessary formatting changes removed: https://github.com/akien-mga/godot/tree/dream-young-soul/dotnet-process-startinfo-utf8

It's a bit of a crash, and the number of submissions is increasing. Please help me with this PR. I should learn how to use github

@akien-mga
Copy link
Member

I can't update this PR it seems, probably you disabled this option when making the PR:
image

I'll make a new PR with those changes.

@akien-mga
Copy link
Member

Superseded by #73865.

@dream-young-soul
Copy link
Author

由#73865取代。

Thanks

@aaronfranke aaronfranke removed this from the 4.1 milestone Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants