原文地址:http://www.huanghengxu.com/Html/Article/90.htm
在線查看:http://bm.kdd.cc/index.asp
把 GB2312 編碼轉(zhuǎn)成漢字
string s = Convert.ToString(47524, 2); // 轉(zhuǎn)成二進制
byte byte1 = Convert.ToByte(s.Substring(0, 8), 2);
byte byte2 = Convert.ToByte(s.Substring(8), 2);
byte[] array = new byte[2] { byte1, byte2 };
MessageBox.Show(System.Text.Encoding.GetEncoding("GB2312").GetString(array));
漢字獲取 GB2312 編碼
byte[] array = System.Text.Encoding.GetEncoding("GB2312").GetBytes("工");
string s1 = Convert.ToString(array[0], 16);
string s2 = Convert.ToString(array[1], 16);
int i = Convert.ToInt32(s1 + s2, 16);
MessageBox.Show(i.ToString());
posted on 2010-06-12 17:42
漂漂 閱讀(2644)
評論(2) 編輯 收藏 引用 所屬分類:
c#開發(fā)