读C#开发实战1200例子记录-2017年8月14日11:20:38获取汉字编码值
try
{
char chr = textBox1.Text[0];
byte[] gb2312_bt = Encoding.GetEncoding("gb2312").GetBytes(new Char[] { chr });
int n = (int)gb2312_bt[0] << 8;
n += (int)gb2312_bt[1];
textBox2.Text = n.ToString();
}
catch(Exception)
{
MessageBox.Show("请输入汉字字符!","出现错误!");
}
获取汉字编码值
本文来自博客园,作者:landv,转载请注明原文链接:https://www.cnblogs.com/landv/p/7356782.html

浙公网安备 33010602011771号