C# 汉子增加UTF-8头

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;
}
}
}
上一篇:测试人员学Java入门指南


下一篇:第五章 Spring3.0 、Hibernate3.3与Struts2的整合