在利用webClient 抓取 编码方式为 GB2312 网页 提示不支持‘gb2312‘ is not a supported encoding name
解决办法 :
1.nuget引用dll:System.Text.Encoding.CodePages
2. startup文件中配置
//直接在starup.cs启动文件里的方法添加 public void Configure(IApplicationBuilder app, IHostingEnvironment env) { System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); }
以上可解决 asp.net core 或 webClient 不支持 gb2312编码问题