C# 汉子增加UTF-8头
2024-10-15 18:59:51
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; namespace ConvertToUtf8
{
public class ClassFun
{
public static byte[] Pathology_ConvertToBinary(string source)
{
byte[] utf8Prefix = Encoding.UTF8.GetPreamble();
byte[] utf8Content = System.Text.Encoding.UTF8.GetBytes(source);
byte[] NewUtf8Content = new byte[utf8Prefix.Length + utf8Content.Length];
int NewUtf8ContentCount = ;
for (int i = ; i < utf8Prefix.Length; i++)
{
NewUtf8Content[NewUtf8ContentCount] = utf8Prefix[i];
NewUtf8ContentCount++;
}
for (int j = ; j < utf8Content.Length; j++)
{
NewUtf8Content[NewUtf8ContentCount] = utf8Content[j];
NewUtf8ContentCount++;
} return NewUtf8Content;
}
}
}
最新文章
- Undo/Redo for Qt Tree Model
- DirectX11 SDK 例程报错解决方法
- find 查找文件 -exec 然后压缩 查看tar包的内容
- Linux磁盘操作命令
- hihoCoder挑战赛23
- 51.ISE中的DCM全局时钟转为普通IO
- System.web.optimization 在 Asp.Net WebForm 中应用得注意了
- 【BZOJ】1925: [Sdoi2010]地精部落 DP+滚动数组
- Oracle---->;基本DDL
- Vijos P1521 跳舞 贪心
- 「OC」构造方法和分类
- leetcode:Reverse Nodes in k-Group(以k为循环节反转链表)【面试算法题】
- Go笔记-标准库的介绍
- codeforces 983B XOR-pyramid
- Service Fabric部署笔记
- 设计模式之一工厂方法模式(Factory Method)
- HBASE分布式集群搭建(ubuntu 16.04)
- 关于Numba开源库(Python语法代码加速处理,看过一个例子,速度可提高6倍)
- 自动化部署-从maven到shell脚本到jenkins
- EntityFramework笔记