Just one sentence after the one you quoted:
> However, the javac compiler is affected because it assumes that .java source files are encoded with the default charset, unless configured otherwise by the -encoding option.
Interestingly, in Windows, Java programs were supposedly encoded in CP-1252 before this...?
> In JDK 17 and earlier, the default charset is determined when the Java runtime starts. On macOS, it is UTF-8 except in the POSIX C locale. On other operating systems, it depends upon the user's locale and the default encoding, e.g., on Windows, it is a codepage-based charset such as windows-1252 or windows-31j.
1. javac is an implementation, not a specification.
2. As noted in the very quote provided, said particular implementation accepts various encodings; naturally, as the language allows various encodings.
That is quite unlike the languages that specify that anything other than UTF-8 is invalid code.