.NET Core doesn't know about Windows 1252, how to fix?

This program works just fine when compiled for .NET 4 but does when compiled for .NET Core. I understand the error about encoding not supported but not how to fix it.

Public Class Program
    Public Shared Function Main(ByVal args As String()) As Integer
    End Function
End Class


To do this, you need to register the CodePagesEncodingProvider instance from the System.Text.Encoding.CodePages package.

To do that, install the System.Text.Encoding.CodePages package:

dotnet add package System.Text.Encoding.CodePages

Then (after implicitly or explicitly running dotnet restore) you can call:

var enc1252 = Encoding.GetEncoding(1252);

Alternatively, if you only need that one code page, you can get it directly, without registration:

var enc1252 = CodePagesEncodingProvider.Instance.GetEncoding(1252);

Please write:

    <PackageReference Include="System.Text.Encoding.CodePages" Version="4.3.0" />

in csproj.

In package console write ' dotnet restore', restore assemblies.

and wite this code for sample:

public class MyClass
    static MyClass()

Need Your Help

Is java.sql.Connection thread safe?

java multithreading jdbc thread-safety dbconnection

To rephrase the question: should I avoid sharing instances of classes which implement java.sql.Connection between different threads?

Consequences of POST not being idempotent (RESTful API)

http rest post put idempotent

I am wondering if my current approach makes sense or if there is a better way to do it.