RFR: 8356985: Use "stdin.encoding" in Console's read*() methods

Naoto Sato naoto at openjdk.org
Sat May 17 00:13:05 UTC 2025


`java.io.Console` uses the charset specified by the `stdout.encoding` system property for both input and output. While this is generally sufficient, since Console is intended for interactive terminal use, some platforms allow different encodings to be configured for input and output. In such cases, using a single encoding may lead to incorrect behavior when reading from the terminal. To address this, the newly introduced system property, `stdin.encoding`, should be used specifically for input where appropriate.

-------------

Commit messages:
 - Tests read* method variations
 - Merge branch 'master' into JDK-8356985-Use-stdin-encoding-in-Console
 - initial commit

Changes: https://git.openjdk.org/jdk/pull/25271/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25271&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8356985
  Stats: 270 lines in 11 files changed: 241 ins; 3 del; 26 mod
  Patch: https://git.openjdk.org/jdk/pull/25271.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25271/head:pull/25271

PR: https://git.openjdk.org/jdk/pull/25271


More information about the core-libs-dev mailing list