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

Wrong Chinese encoding for MSBuild errors in the editor #71326

Closed
L2750558108 opened this issue Jan 13, 2023 · 9 comments · Fixed by #74065
Closed

Wrong Chinese encoding for MSBuild errors in the editor #71326

L2750558108 opened this issue Jan 13, 2023 · 9 comments · Fixed by #74065

Comments

@L2750558108
Copy link

Godot version

4.0(beta 11) mono

System information

windows10

Issue description

image

Steps to reproduce

Set the editor language to chinese
Create a C# project
Create a scene
Create a C# script
Build it
Go to MSBuild Window
See the chinese display error

Minimal reproduction project

An empty project

@akien-mga
Copy link
Member

Can you translate the error, or is it invalid Chinese? I see some characters are mangled (e.g. "Debug" lacks the "D").

Could you confirm which is the bug / unexpected behavior you are experiencing?

  • There is an error (in Chinese) when using the editor in Chinese. There is no error when using the editor in English.
  • There is an error both when using the editor in English and in Chinese, but you do not expect the error message to be presented in Chinese and would prefer it to be always in English?

@L2750558108
Copy link
Author

Whether I'm using a Chinese or English editor, some strange characters that look like Chinese decoding errors appear. I think maybe it's because my computer language is Chinese so the compilation information returned by MSBuild is also Chinese, then the Godot editor decodes it incorrectly and then shows the wrong characters.

@akien-mga akien-mga changed the title The MSBuild window Chinese displayed an error Wrong Chinese encoding for MSBuild errors in the editor Jan 13, 2023
@timothyqiu
Copy link
Member

timothyqiu commented Jan 13, 2023

Probably related: #64276

@L2750558108 Can you reproduce this error when starting from the _console.exe version?

@L2750558108
Copy link
Author

image

@mrbbbaixue
Copy link
Contributor

试试复制这些出错的文字,用这个网址http://www.mytju.com/classCode/tools/messyCodeRecover.asp 看看来源的编码方式和造成错误的编码?

Try copy this corrupt words and using this website, to determine what your computer default encoding (codepage) is, and what encoding methods cause this error?

@L2750558108
Copy link
Author

L2750558108 commented Jan 14, 2023

image
image

@mrbbbaixue
Copy link
Contributor

mrbbbaixue commented Jan 14, 2023

Reproduce on Godot 4 beta 12 mono:

image

Seems Godot decodes GBK strings using UTF-8:
image

The console output seems follow Windows system display language (or default CodePage of the shell), when using godot in english, the error still happens:
image
Running chcp 65001 before using console.exe is not working.

If you select default Windows Display language to Simplified Chinese on the initial setup (OOBE) of Windows, the default codepage will be set to 936 (GBK), but in most case of software dev, we uses 65001 (UTF-8), that's the problem that cause the issue.
Japan 932, Korea 949, Chinese Taiwan 950 also uses their specific codepages, that might also cause issue similar to this.

@paulloz
Copy link
Member

paulloz commented Jan 24, 2023

We could consider forcing MSBuild into the same language as the editor.

@nagilson
Copy link

nagilson commented Mar 8, 2023

FYI I am working on a change for MSBuild to use UTF 8 if it's running in the context where DOTNET_CLI_UI_LANGUAGE is set. Might fix this for you. dotnet/msbuild#8503

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment