How to find Encoding for 1251 codepage

Viewed 27267

I need to create System.Encoding for 1251 codepage.

On my russian Windows I use

Encoding encoding = Encoding.Default

I am afraid this will produce different results depending on Windows

3 Answers

The .NET Framework/.NET Core supports a large number of character encodings and code pages. To retrieve an encoding that is present in the .NET Framework/.NET Core pass the EncodingProvider object to the Encoding.RegisterProvider method to make the encodings supplied by the EncodingProvider object available to the common language runtime. Microsoft Document Reference

System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
Related