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. 我对Java内存模型的理解

    所有的编程语言中都有内存模型这个概念,区别于微架构的内存模型,高级语言的内存模型包括了编译器和微架构两部分.我试图了解了Java.C#和Go语言的内存模型,发现内容基本大同小异,只是这些语言在具体实现 ...

  2. 通过双 key 来解决缓存并发问题

    我们在使用缓存的时候,不管Redis或者是Memcached,基本上都会遇到以下3个问题:缓存穿透.缓存并发.缓存集中失效.这篇文章主要针对[缓存并发]问题展开讨论,并给出具体的解决方案. 1.什么是 ...

  3. Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Faile

    解决方法: 1.新建一个安卓应用,复制下面路径红色框的代码  去替换  导入应用中的代码,就是修改gradle版本: 2.在导入的应用中如下路径添加信息 代码: android.overridePat ...

  4. NET 6 中新增的LINQ 方法

    .NET 6 中添加了许多 LINQ 方法. 下表中列出的大多数新方法在 System.Linq.Queryable 类型中具有等效方法. 欢迎关注 如果你刻意练习某件事情请超过10000小时,那么你 ...

  5. 手撕vector

    Myclass.h #pragma once #include<iostream> #include<Windows.h> #define SUCCESS 1 // 成功 #d ...

  6. git 报错 error: bad signature 0x00000000 fatal: index file corrupt

    index file在 git 里面一般指的是 .git/index 这个文件.这个文件保存的是暂存区的信息(索引信息). 报错说明这个文件已经损坏了 直接删除这个文件,然后执行如下命令 git re ...

  7. 知乎 微软当年的 J++ 究竟是什么?为什么 Sun 要告它? zz

    https://www.zhihu.com/question/22814456 考个古

  8. 2024年1月Java项目开发指南12:前后端分离项目跨域问题解决

    创建config文件夹,创建WebConfig文件 代码如下(可以直接抄) package cc.xrilang.serversystem.config; import org.springframe ...

  9. 关于Java的UUID

    UUID或者UNID或者UID,是一个统一唯一标识,可以用来标记文档.数据或其它需要唯一标识的东西.Java 5.0内置UUID的实现,见java.util.UUID. 下面代码是找到的2种实现方式, ...

  10. Qt编写推流综合应用示例-文件推流

    一.功能特点 1.1 文件推流 指定网卡和监听端口,接收网络请求推送音视频等各种文件. 实时统计显示每个文件对应的访问数量.总访问数量.不同IP地址访问数量. 可指定多种模式,0-直接播放.1-下载播 ...