在利用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編碼問題