0
点赞
收藏
分享

微信扫一扫

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

天天天蓝loveyou 2022-03-30 阅读 81
.netide


        在.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”的错误_.net

        解决办法,在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”的错误_ide_03 

         问题解决!


举报

相关推荐

gb2312是如何兼容ascii码的?

UTF-8和gb2312字符集的区别

0 条评论