读书人

\u5df2 这个是什么字 怎么计算

发布时间: 2012-01-15 22:57:49 作者: rapoo

\u5df2 这个是什么字 如何计算
\u5df2 这个是什么字 如何计算

string unicode = "5df2 ";
string s1 = unicode.Substring(0, 2);
string s2 = unicode.Substring(2, 2);


int t1 = Convert.ToInt32(s1, 16);
int t2 = Convert.ToInt32(s2, 16);

byte[] array = new byte[2];
array[0] = (byte)t1;
array[1] = (byte)t2;

string s = System.Text.Encoding.Unicode.GetString(array);
得出的是乱码

[解决办法]
string unicode = "5df2 ";
Text = " " + (char)int.Parse(unicode, System.Globalization.NumberStyles.HexNumber);

读书人网 >C#

热点推荐