时间:2021-07-01 10:21:17 帮助过:33人阅读
/// <summary>
/// Unicode字符转换为中文字符,如96F7,78CA等"
/// </summary>
private char UnicodeToChineseByHex(string Unicode)
{
return (char)int.Parse(Unicode, System.Globalization.NumberStyles.HexNumber);
}
/// <summary>
/// Unicode字符转换为中文字符,如96F7,78CA等
/// 注意:解码从后向前的
/// </summary>
private string UnicodeToChinese(string Unicode)
{
byte[] array = new byte[Unicode.Length / 2];
for (int i = 0; i < array.Length; i++)
{
string s1 = Unicode.Substring(Unicode.Length - (i + 1) * 2, 2);
int t1 = Convert.ToInt32(s1, 16);
array[i] = (byte)t1;
}
return System.Text.Encoding.Unicode.GetString(array);
}
/// <summary>
/// 中文字符转换为Unicode字符,如'雷'等
/// </summary>
private string ChineseToUnicode(char Chinese)
{
return ((int)Chinese).ToString("x");
}