日期:2014-05-17 浏览次数:20896 次
string str = "4";
EncodingInfo[] array = Encoding.GetEncodings();
foreach (EncodingInfo item in array)
{
try
{
Encoding encoding = item.GetEncoding();
byte[] bytes = encoding.GetBytes(str);
ushort number = BitConverter.ToUInt16(bytes, 0);
if (number == 65300)
{
Console.WriteLine(item.Name);
break;
}
}
catch
{
}
}