最近研究编码,byte[]和int 各类型转换时发现

 

byte[] a= Encoding.Default.GetBytes("啊");
            int area = (short)a[0];               
            int pos = (short)a[1];
            int code = (area << 8) + pos;

 

code 是gb2312 的中文编码号,是一个整数

 

但是,使用

byte[] b=BitConverter.GetBytes(code);

得到的 b和a是不一样的

 

a是高位存低位

b却是高位存高位

相关文章:

  • 2022-02-02
  • 2022-12-23
  • 2021-11-29
  • 2021-10-26
  • 2021-12-30
  • 2021-10-29
  • 2022-12-23
猜你喜欢
  • 2021-08-28
  • 2022-12-23
  • 2022-01-16
  • 2021-07-18
  • 2022-12-23
  • 2021-08-25
  • 2021-11-21
相关资源
相似解决方案