我需要逐个字符地解析 UTF-8 输入(来自文本文件)(按字符我指的是完整的 UTF-8 字符(UTF-8 代码点),而不是 Java 的字符)。
我应该使用什么方法?
最佳答案
例如:
String text = Files.readString(Path.of("test.txt"));
IntStream codePoints = text.codePoints();
// do something with the code points
codePoints.forEach(codePoint -> System.out.println(codePoint));
关于java - 从 Java 输入流中读取下一个字符(完整的 unicode 代码点),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26391790/