Open frg2089 opened 1 year ago
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
It also in .Net 8.0
This garble looks like it is caused by UTF-8 encoded content being saved incorrectly as GB18030 (GBK or GB2312).
Maybe it's a problem here.
It looks like the code here causes being redirected when the current OS is not iOS, Android, TV OS and browser to force UTF-8 encoding, while PowerShell running on Windows will treat them as if they were ANSI.
yes, it IS because the encoding issues, but i don't know how to solve it.
My problem is using redirection in cmd prompt when I was learning
yes, it IS because the encoding issues, but i don't know how to solve it. My problem is using redirection in cmd prompt when I was learning chapter8. But both my input and output don't have ANY Chinese character, but it still went wrong. Two lines were replaced by garbled codes! For No reason!! This is just like a black box, and I have nothing to do about it, so powerless...
What is your dotnet version? and What's your PowerShell version?
Describe the bug
When I use PowerShell in a Chinese environment to redirect the output of a dotnet program, I get some garbled.
It can also happen in the pipeline.
I tested MSBuild for Visual Studio, MSBuild for .Net Framework and other applications. Only dotnet does this.
And I tested PowerShell 7.3, Windows PowerShell 5.1 and Command Prompt. this only happens on PowerShell 7.3 and Windows PowerShell 5.1.
To Reproduce
Further technical details
Windows Display Language
![Windows Display Language](https://user-images.githubusercontent.com/42184238/234178182-a646d809-b6ab-4a91-b5c3-7f8a235b3b01.png)
Direct run in PowerShell 7.3
![Direct run in PowerShell 7.3](https://user-images.githubusercontent.com/42184238/234178234-d24aafaa-7733-433b-90f9-54b308dfc087.png)
Redirect into file
![Redirect into file](https://user-images.githubusercontent.com/42184238/234178341-89545594-f2fd-4229-a667-f5aef06f5e8c.png)