lipengxs

 

若使用utf-8编码,中文占3个字节,英文的话只占一个字节
System.out.println("人".getBytes().length);  输出3

若使用unicode编码,则是2个字节

System.out.println("人".getBytes().length);  输出2

若在windows上使用GBK编码,则占用2个字节

 

System.out.println("人".getBytes().length);  输出2

 

 

分类:

技术点:

相关文章:

  • 2021-12-06
  • 2022-12-23
  • 2021-09-29
  • 2021-06-08
  • 2021-12-06
  • 2021-11-29
  • 2022-12-23
猜你喜欢
  • 2021-12-30
  • 2021-11-29
  • 2022-12-23
  • 2021-07-04
  • 2021-11-29
  • 2021-12-16
  • 2022-12-23
相关资源
相似解决方案