Skip to main content

One post tagged with "utf-8"

View All Tags

utf8 and utf16 and encoding and java

· One min read

背景

java 的字符串会设计很多编码相关的问题,全部整理一下

知识点

Code Unit

code unit 描述的是一个编码的的最小单位(注意一个Unicode 平面对应的字符可能由多个code unit 组成)

编码unit code
utf-81字节
utf-162字节

java 的char

java 的char 是2个字节,类型的范围是 0 到 2^16 - 1.