[Breaking change]: .NET SDK No Longer Changes Encoding Upon Exit #34471
Labels
binary incompatible
Existing binaries may encounter a breaking change in behavior.
breaking-change
Indicates a .NET Core breaking change
🏁 Release: .NET 8
Work items for the .NET 8 release
doc-idea
Indicates issues that are suggestions for new topics [org][type][category]
Pri1
High priority, do before Pri2 and Pri3
📌 seQUESTered
Identifies that an issue has been imported into Quest.
Description
Also applies to 7.0.300. Work done: dotnet/sdk#30963
Similar to #34250 but the bug mentioned where the SDK changed the encoding of an entire console has been fixed. Its possible users began to rely on the SDK changing the encoding of the command line console upon exit even for other programs ran on that console, but that is incorrect behavior.
The other change is that we no longer change the encoding as mentioned in #34250 for old builds of Windows that don't officially support it, and instead require opt-in.
Version
.NET 8 Preview 3
Previous behavior
dotnet build
.New behavior
Type of breaking change
Reason for change
First
A) We changed the encoding for older versions of windows 10 that had undefined behavior as those early builds didn't support utf-8 (builds before the Nov 2019 update.) Since it is not officially supported, we don't want this behavior by default and instead provide an opt-in.
B) We fixed dotnet/msbuild#1596 which was an existing issue in .NET 7 where the SDK affected the encoding on the console for other programs. Running the .NET SDK should not impact the output of other programs.
Recommended action
Applications that need to change the codepage can do so by running a process to invoke the
chcp
command on Windows. They shouldn't rely on the SDK to do so.If you would like to keep the encoding change inside the SDK (but it still won't stay after the SDK is finished executing a command) for non-en languages in Windows 10 versions that don't officially support UTF-8, which is any build of before the Windows 10 (November 2019 update), you should set the environment variable
DOTNET_CLI_FORCE_UTF8_ENCODING
. This should also be mentioned here. https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-environment-variablesFeature area
SDK
Affected APIs
No response
Associated WorkItem - 82741
The text was updated successfully, but these errors were encountered: