'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