using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ToolsClassLibrary
{
///
/// 自定义编码转换 ASCII UTF_8
///
public static class MyEncoding
{
///
/// 编码ASCII
///
///
///
public static byte[] EncodingASCII(string buf)
{
byte[] data = Encoding.Unicode.GetBytes(buf);
return data;
}
///
/// 解码ASCII
///
///
///
public static string DecodingASCII(byte[] bt)
{
string st = Encoding.Unicode.GetString(bt);
return st;
}
///
/// 编码UTF_8
///
///
///
public static byte[] EncodingUTF_8(string buf)
{
byte[] data = Encoding.UTF8.GetBytes(buf);
return data;
}
///
/// 编码UTF_8
///
///
///
public static string DecodingUTF_8(byte[] bt)
{
string st = Encoding.UTF8.GetString(bt);
return st;
}
}
}