日期:2014-05-17 浏览次数:20872 次
string text = ScreenBox.Text;
ScreenBox.Clear();
byte[] textToByte = Encoding.Default.GetBytes(text);
for (int i = 0; i < textToByte.Length; i++)
{
byte temp = textToByte[i];
string tempHex = temp.ToString("X2") + " ";
ScreenBox.Text += tempHex;
}
string Hextext = ScreenBox.Text;
///<summary>
/// 从16进制转换成汉字
/// </summary>
/// <param name="hex"></param>
/// <param name="charset">编码,如"utf-8","gb2312"</param>
/// <returns></returns>
public static string UnHex(string hex, string charset)
{
if (hex == null)