【发布时间】:2025-12-30 09:00:10
【问题描述】:
假设我将 Java 字符数组 (char[]) 实例编码为字节:
- 每个字符使用两个字节
- 使用大端编码(将最高有效 8 位存储在最左边的字节中,将最低有效 8 位存储在最右边的字节中)
这会始终创建有效的 UTF-16BE 编码吗?如果不是,哪些代码点会导致编码无效?
这个问题与this question about the Java char type和this question about the internal representation of Java strings非常相关。
【问题讨论】:
标签: java arrays unicode character-encoding char