1、问题描述

在.Net Core中使用Encoding.GetEncoding("GB2312")报如下错误:

System.ArgumentException:“'GB2312' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. Arg_ParamName_Name”


2、解决办法

在NuGet中下载“System.Text.Encoding.CodePages”包:

然后在var bytes = Encoding.GetEncoding("GB2312").GetBytes(strTemp);之前注册对编码进行注册:Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

到此,问题解决!

.Net Core报“‘GB2312‘ is not a supported encoding name. For information on defining a custom encod”的错误的更多相关文章

  1. .Net Core 遇到 “'windows-1252' is not a supported encoding name.”

    使用iTextSharp生成Pdf文件时报错如下: 'windows-1252' is not a supported encoding name. For information on defini ...

  2. .Net Core 遇到 “'windows-1252' is not a supported encoding name.”

    最近用 iTextSharp 拆分 Pdf 文档 加水印的时候遇到错误: 'windows-1252' is not a supported encoding name. For informatio ...

  3. 如何让.NET Core支持GB2312和GBK

    在.NET Core中,默认是不支持GB2312和GBK编码的. 例如我们如果新建一个.NET Core控制台项目,然后在其Main方法中使用如下代码: using System; using Sys ...

  4. 保存xml报错 'UTF_8' is not a supported encoding name

    ArgumentException: 'UTF_8' is not a supported encoding name. For information on defining a custom en ...

  5. Putty使用公钥认证时,报错:Disconnected: No supported authentication methods available(server sent:public key) 问题的解决

    Putty使用公钥认证时,按照常规方法设置,一直报错:Disconnected: No supported authentication methods available (server sent: ...

  6. input()报错:TypeError: '>=' not supported between instances of 'str' and 'int'

    今天学习python基础—分支与循环,接触到了if.在练习一个if语句的时候,出现了错误. 题目是: 根据分数划分成四个级别:优秀.良好.及格.不及格,分数是72: grade = 72if grad ...

  7. Maven工程 报 Diamond types are not supported at language level '5'

    Maven工程 报 Diamond types are not supported at language level '5' 出现这种信息,一般表示的是你的language level(IDEA下J ...

  8. (TODO:)下载图片,报错:warning: could not load any Objective-C class information from the dyld shared cache. This will significantly reduce the quality of type information available.

    想使用NSInvocationOperation下载图片,然而并没有下载下来, NSData为nil, 还有报错:(打断点就报错) warning: could not load any Object ...

  9. WCF服务接口多,客户端在引用时出错!报WCF The maximum nametable character count quota (16384) has been exceeded while reading XML data错误

    WCF服务接口多,客户端在引用时出错!报WCF The maximum nametable character count quota (16384) has been exceeded while ...

  10. zookeeper报错java.net.ConnectException: Connection refused: no further information

    zookeeper报错java.net.ConnectException: Connection refused: no further information 这是在linux 启动 https:/ ...

随机推荐

  1. 推荐7个最强Appium替代工具,移动App自动化测试必备!

    在移动应用开发日益火爆的今天,自动化测试成为了确保应用质量和用户体验的关键环节.Appium 作为一款广泛应用的移动应用自动化测试工具,为测试人员所熟知.然而,在不同的测试场景和需求下,还有许多其他优 ...

  2. QT日志类SimpleQtLogger的简单记录

    在现代软件开发中,日志记录是必不可少的部分.它不仅帮助开发者在调试和维护软件时了解程序的运行状态,还能提供关键的错误信息.对于使用Qt框架开发应用程序的开发者来说,选择一个合适的日志库至关重要.本文将 ...

  3. cockpit-325以及新版本安装和cockpit-files安装

    查看版本cockpit可安装版本,发现最新的只有310版本 sudo yum list cockpit --showduplicates Last metadata expiration check: ...

  4. 【Amadeus原创】docker安装apache

    1, docker下载apache [root@it-1c2d webnav]# docker search apache [root@it-1c2d webnav]# docker pull htt ...

  5. 2024年1月Java项目开发指南11:axios请求与接口统一管理

    axios中文网:https://www.axios-http.cn/ 安装 npm install axios 配置 在src下创建apis文件夹 创建axios.js文件 配置如下: // src ...

  6. 【C#】【平时作业】习题-13-数据类型

    目录 1. 什么是 ArrayList ,如何存放数据? 2. 什么 Queue ,如何存放数据? Queue 类的方法和属性 3. 什么 Stack ,如何存放数据? 4. 什么 Hashtable ...

  7. bug记录:Vue.use 加载 TabPane ,浏览器卡死

    问题描述 Vue.use 加载 TabPane ,浏览器卡死 原因分析 参考资料:https://blog.csdn.net/ye987987/article/details/103780297 经过 ...

  8. 【转载】茅台巽风app地图详解,做任务不迷路,纯手绘

    茅台发布了新的app"巽风" 根据"巽值"的排名,发放20000个虎年茅台的资格,还是可以玩一玩的 哪些途径获取"巽值" 1.做任务,和游戏 ...

  9. java正则表达式(find()和 matches())

    1.find()方法是部分匹配,是查找输入串中与模式匹配的子串,如果该匹配的串有组还可以使用group()函数. matches()是全部匹配,是将整个输入串与模式匹配,如果要验证一个输入的数据是否为 ...

  10. [转]Spring+SpringMVC+MyBatis+easyUI整合基础篇(一)项目简述及技术选型介绍

    原文链接: Spring+SpringMVC+MyBatis+easyUI整合基础篇(一)项目简述及技术选型介绍