RFR: 8357996: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [tools] [v3]

Volkan Yazici vyazici at openjdk.org
Fri Jun 13 06:44:45 UTC 2025


On Thu, 12 Jun 2025 18:58:09 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> Volkan Yazici has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains seven commits:
>> 
>>  - Merge remote-tracking branch 'upstream/master' into stdinEnc-build
>>  - Provide fallback for `stdin.encoding` in `ExternalEditor`
>>  - Discard changes unrelated with build and tools
>>  - Revert superfluous changes
>>    
>>    Remove assertion in `DOMImplementationRegistry`
>>  - Revert changes to 3rd parties in `com/sun/org/apache`
>>  - Revert `PandocFilter` changes
>>    
>>    `PandocFilter` et al. gets called using the boot JDK,
>>    which doesn't have `stdin.encoding` yet.
>>  - Use `stdin.encoding` in `InputStreamReader` and `Scanner` instantiations
>>    
>>    Improve `CharsetTest`
>
> src/jdk.internal.ed/share/classes/jdk/internal/editor/external/ExternalEditor.java line 170:
> 
>> 168:                 // -wait option -- ignore process exit, wait for carriage-return
>> 169:                 Charset charset = Charset.forName(System.getProperty("stdin.encoding"), Charset.defaultCharset());
>> 170:                 Scanner scanner = new Scanner(System.in, charset);
> 
> I think the code is simply expecting a CR, so this change may not be needed.

Correct. I could not be sure if CR is always the same across all charsets.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25541#discussion_r2144311307


More information about the kulla-dev mailing list