//由区位码转为汉字.
//"D3EA"相对于汉字"雨"

   System.Text.Encoding gb = System.Text.Encoding.GetEncoding("gb2312");
   byte[] bytes = new byte[]{ Convert.ToByte("d3",16),Convert.ToByte("ea",16)};
   string strResult = gb.GetString( bytes );
   MessageBox.Show( strResult );

//由汉字转为区位码
//将"雨"字转为相对的区位码(16进制)

   bytes = gb.GetBytes( strResult );
   string strTemp = " " ;
   for( int i = 0 ;i<bytes.Length; i++)
   {
    strTemp += Convert.ToString( bytes[i],16 ) + " ";
   }
   MessageBox.Show(strTemp.Trim());


参考:

GB2312简体中文编码表
http://www.aspxboy.com/1885/archive.aspx

汉字编码简明对照表
http://www.aspxboy.com/1886/archive.aspx

相关文章:

  • 2022-02-16
  • 2022-12-23
  • 2021-08-27
  • 2021-09-22
  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-03-01
  • 2022-12-23
  • 2021-07-23
  • 2022-01-28
  • 2022-03-07
  • 2022-12-23
  • 2021-07-05
相关资源
相似解决方案