c# Encoding.GetEncoding
Encoding.GetEncoding 是 C# 中的一个方法,它用于获取特定名称的编码的 Encoding 对象。如果指定的编码名称不存在,则会抛出 ArgumentException。
获取 UTF-8 编码:
Encoding encoding = Encoding.GetEncoding(“utf-8”);
获取 ASCII 编码:
Encoding encoding = Encoding.GetEncoding(“us-ascii”);
获取 Windows-1252 编码:
Encoding encoding = Encoding.GetEncoding(“windows-1252”);
获取 ISO-8859-1 编码:
Encoding encoding = Encoding.GetEncoding(“iso-8859-1”);
获取 GB2312 编码:
Encoding encoding = Encoding.GetEncoding(“gb2312”);
获取 GBK 编码:
Encoding encoding = Encoding.GetEncoding(“gbk”);
获取 Big5 编码:
Encoding encoding = Encoding.GetEncoding(“big5”);
获取 Shift_JIS 编码:
Encoding encoding = Encoding.GetEncoding(“shift_jis”);
获取 Euc-kr 编码:
Encoding encoding = Encoding.GetEncoding(“euc-kr”);
获取 KOI8-R 编码:
Encoding encoding = Encoding.GetEncoding(“koi8-r”);
原文地址:https://blog.csdn.net/weixin_45751713/article/details/143718272
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!