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

LANG env var should be changed to en_US.utf-8 #909

Open
jander-msft opened this issue Aug 9, 2023 · 1 comment
Open

LANG env var should be changed to en_US.utf-8 #909

jander-msft opened this issue Aug 9, 2023 · 1 comment

Comments

@jander-msft
Copy link
Member

Several of the Dockerfiles seem to be setting LANG environment variable to en_US.utf8: https://github.com/search?q=repo%3Adotnet%2Fdotnet-buildtools-prereqs-docker%20en_US.utf8&type=code

The doesn't seem to be correct, because it causes first chance exceptions:

[xUnit.net 00:02:29.38]         System.ArgumentException: 'utf8' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter 'name')
[xUnit.net 00:02:29.38]            at System.Text.EncodingTable.InternalGetCodePageFromName(System.String)
[xUnit.net 00:02:29.38]            at System.Text.EncodingTable.GetCodePageFromName(System.String)
[xUnit.net 00:02:29.38]            at System.Text.Encoding.GetEncoding(System.String)
[xUnit.net 00:02:29.38]            at System.Text.EncodingHelper.GetEncodingFromCharset()
[xUnit.net 00:02:29.38]            at System.ConsolePal.GetConsoleEncoding()
[xUnit.net 00:02:29.38]            at System.Console.get_OutputEncoding()
[xUnit.net 00:02:29.38]            at System.Console.CreateOutputWriter(System.IO.Stream)
[xUnit.net 00:02:29.38]            at System.Console.<get_Out>g__EnsureInitialized|26_0()
[xUnit.net 00:02:29.38]            at System.ConsolePal.EnsureInitializedCore()
[xUnit.net 00:02:29.38]            at System.ConsolePal.Write(Microsoft.Win32.SafeHandles.SafeFileHandle,System.ReadOnlySpan`1[[System.Byte, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]][System.Byte],System.Boolean)
[xUnit.net 00:02:29.38]            at System.Text.Json.Utf8JsonWriter.Flush()

According to the System.Text.EncodingTable class (https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/System/Text/EncodingData.cs#L57), the value should be en_US.utf-8 (note the hyphen).

@mthalman
Copy link
Member

@jander-msft - Is this something you'd like to submit a PR for to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

2 participants