在.Net Core中使用Encoding.GetEncoding("GB2312")报如下错误:

System.ArgumentException:“'GB2312' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. Arg_ParamName_Name”

.Net Core报“‘GB2312‘ is not a supported encoding name. For information on defining a custom encod”的错误_ide

        解决办法,在NuGet中下载“System.Text.Encoding.CodePages”包:

 .Net Core报“‘GB2312‘ is not a supported encoding name. For information on defining a custom encod”的错误_.net_02

        然后在var bytes = Encoding.GetEncoding("GB2312").GetBytes(strTemp);之前注册对编码进行注册:​Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

.Net Core报“‘GB2312‘ is not a supported encoding name. For information on defining a custom encod”的错误_.net_03 

         问题解决!