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. apisix 转发 路由自动encode导致带中括号的文件下载404

    问题:apisix 转发 路由自动encode导致带中括号的文件下载404 原因:因为apisix 解码后tomcat处理会有问题,下载不了 解决方案:请求改写---协议,选择保持原样

  2. HashMap 源码解毒

    PUT 方法解毒: hashcode 高低16进行异或运算,尽量降低哈希冲突的概率 如果数组很小,hashcode的高位就不能被很好利用. final V putVal(int hash, K key ...

  3. 【Web前端】【开源分享】H5登陆界面 - 2021年12月24日

    点我下载

  4. 【Java】【Spring Boot】CP01:创建一个SpringBoot项目(Spring Initializr)

    设置(可跳过这一步) 点击Apply 然后点击OK 创建项目 目前不需要勾选什么,以后根据需要勾选 创建一个名为controller的文件夹(控制层),并在文件夹中创建一个HelloControlle ...

  5. Uninstall or delete MariaDB completely for re-installation

    I am new to this forum so pse forgive me if I am asking a question which already has been answered. ...

  6. Linux系统 tcpdump 抓包命令使用教程

    tcpdump 是Linux系统下的一个强大的命令,可以将网络中传送的数据包完全截获下来提供分析.它支持针对网络层.协议.主机.网络或端口的过滤,并提供and.or.not等逻辑语句来帮助你去掉无用的 ...

  7. Qt编写安防视频监控系统67-跨平台及国产系统

    一.前言 得益于Qt的超强跨平台特性,本系统也是跨平台的,亲测的系统包括windows全系列.ubuntu全系列.centeos.国产系统UOS.国产系统银河麒麟.中标麒麟.嵌入式linux.树莓派. ...

  8. Qt开源作品13-三套样式表

    一.前言 在做各种各样的项目中,难免遇到需要设定自己界面风格样式的时候,而Qt提供的qss就是牛逼的为了实现定制各种各样的皮肤的,其实一个完美的UI界面,主要由两大块组成,一个是颜色搭配,一个是布局, ...

  9. Qt音视频开发31-Onvif抓拍图片

    一.前言 抓拍是个很重要的功能,比如在报警视频联动中需要一张实时的图片,很多SDK不提供抓拍功能,而通过预览抓图,得到的图片已不具有实时性,那如何得到实时的图片呢?现在的IPC基本上都支持ONVIF协 ...

  10. Eclipse导入并打开java项目,在“package ***;”左侧提示 Multiple markers at this line,或者在“import java.util.*”左侧提示The import java.util cannot be resolved。

    Eclipse导入并打开java项目,在"package ***:"左侧提示 Multiple markers at this line,或者在"import java. ...