I have a C# .NET Core application.
I run
System.Console.WriteLine(System.Text.Encoding.Default.WebName);
and I get utf-8
However, if I open PowerShell, and issue
[System.Text.Encoding]::Default
I get
IsSingleByte : True
BodyName : iso-8859-1
EncodingName : Westeuropäisch (Windows)
HeaderName : Windows-1252
WebName : Windows-1252
WindowsCodePage : 1252
IsBrowserDisplay : True
IsBrowserSave : True
IsMailNewsDisplay : True
IsMailNewsSave : True
EncoderFallback : System.Text.InternalEncoderBestFitFallback
DecoderFallback : System.Text.InternalDecoderBestFitFallback
IsReadOnly : True
CodePage : 1252
Why is the system-encoding different from the default-encoding ?
And how do I get the system-encoding under these circumstances ?
I mean, I figured out I can get Windows-Codepage 1252 in .NET Core with
System.Text.Encoding.GetEncoding("iso-8859-1").WindowsCodePage
but how do I determine the system's codepage ?