'GBK' is not a supported encoding name. For information on defining a custom encoding, see the docum


.net core web工程 使用“GBK” 报如下错

 

'GBK' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter 'name')

解决:

1、nuget引用 System.Text.Encoding.CodePages 包

2、在使用前 先用“System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);” 注册

    System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
            byte[] server_ip = Encoding.GetEncoding("GBK").GetBytes(sendContentModel.ServerIp);

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM