net core设置ftp编码报错

异常内容:'gb2312' is not a supported encoding name. For information on defining a custom encoding,see the documentation for the Encoding.RegisterProvider method.(Parameter 'name')

解决方案:项目中引用System.Text.Encoding.CodePages依赖

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


Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
Encoding encoding = Encoding.GetEncoding("gb2312")

  

posted @ 2022-05-14 10:08  zwbsoft  阅读(36)  评论(0编辑  收藏  举报