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

2025-05-28 Thread Naoto Sato
On Thu, 22 May 2025 17:46:33 GMT, Naoto Sato wrote: >> `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 >> diff

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

2025-05-27 Thread Naoto Sato
On Mon, 26 May 2025 07:18:59 GMT, Alan Bateman wrote: > I assume you've done some "test repeat" jobs to ensure that any variance in > the version of "expect" on test machines doesn't cause any issues. Actually I have not. Thanks for reminding. So I ran this through our internal CI on Linux x64

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

2025-05-26 Thread Alan Bateman
On Thu, 22 May 2025 17:46:33 GMT, Naoto Sato wrote: >> `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 >> diff

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

2025-05-23 Thread Naoto Sato
On Wed, 21 May 2025 16:48:44 GMT, Naoto Sato wrote: >> Created jline/jline3#1282. > > Thanks! JLine seems to incorporate the stdin encoding already, which is quick! - PR Review Comment: https://git.openjdk.org/jdk/pull/25271#discussion_r2105219623

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

2025-05-23 Thread Naoto Sato
On Thu, 22 May 2025 17:46:33 GMT, Naoto Sato wrote: >> `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 >> diff

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

2025-05-23 Thread Stuart Marks
On Thu, 22 May 2025 17:46:33 GMT, Naoto Sato wrote: >> `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 >> diff

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

2025-05-23 Thread Jan Lahoda
On Fri, 23 May 2025 17:18:40 GMT, Stuart Marks wrote: > > Can they even possibly do so? > > Sure, as far as I know, IntelliJ IDEA runs on its own version of the JDK, and > it can easily be invoked or modified to allow use of those modules. I took a > quick look at NetBeans and didn't see any r

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

2025-05-23 Thread Stuart Marks
On Fri, 23 May 2025 16:26:36 GMT, Naoto Sato wrote: > Can they even possibly do so? Sure, as far as I know, IntelliJ IDEA runs on its own version of the JDK, and it can easily be invoked or modified to allow use of those modules. I took a quick look at NetBeans and didn't see any references to

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

2025-05-23 Thread Naoto Sato
On Fri, 23 May 2025 03:47:32 GMT, Stuart Marks wrote: > But... do the IDEs use this to interface to implement their in-IDE terminal > emulator? Can they even possibly do so? `java.base`'s `module-info` exports `jdk.internal.io` only to `jdk.internal.le` and `jdk.jshell`, so I think no other

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

2025-05-22 Thread Stuart Marks
On Thu, 22 May 2025 17:46:33 GMT, Naoto Sato wrote: >> `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 >> diff

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

2025-05-22 Thread Justin Lu
On Thu, 22 May 2025 17:46:33 GMT, Naoto Sato wrote: >> `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 >> diff

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

2025-05-22 Thread Naoto Sato
On Thu, 22 May 2025 16:39:46 GMT, Alan Bateman wrote: >> I'm confused by the actual behavior here. What might be helpful is to divide >> the discussion between a) what charsets get used for input and output, and >> b) the return value of the `charset()` method. >> >> I'm not entirely sure, but

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

2025-05-22 Thread Naoto Sato
> `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

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

2025-05-22 Thread Alan Bateman
On Thu, 22 May 2025 16:15:56 GMT, Stuart Marks wrote: >> Good point. Brought the same wording to the `charset()` method description >> for further clarification. > > I'm confused by the actual behavior here. What might be helpful is to divide > the discussion between a) what charsets get used f

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

2025-05-22 Thread Stuart Marks
On Wed, 21 May 2025 16:48:20 GMT, Naoto Sato wrote: >> src/java.base/share/classes/java/io/Console.java line 67: >> >>> 65: * stdout.encoding}, in which case read operations use the {@code >>> Charset} >>> 66: * designated by {@code stdin.encoding}. >>> 67: * >> >> `Console.charset()` stat

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

2025-05-22 Thread Volkan Yazici
On Wed, 21 May 2025 19:29:08 GMT, Naoto Sato wrote: >> `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 >> diff

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

2025-05-21 Thread Naoto Sato
On Wed, 21 May 2025 18:07:39 GMT, Justin Lu wrote: >>> There is script.exp, but it tests sun.stdout.encoding, not stdout.encoding. >> >> It is addressed in this PR > > I think the JBS bug ID needs to be added to `CharsetTest.java` as well then. Bugid added to the test. Additionally replaced tes

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

2025-05-21 Thread Justin Lu
On Wed, 21 May 2025 16:54:22 GMT, Naoto Sato wrote: >> Actually providing mock charset was a workaround of not having public method >> for getting the input encoding. I think it would be an overkill to introduce >> a new public method because it will not be used much, as most cases are >> suff

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

2025-05-21 Thread Naoto Sato
> `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

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

2025-05-21 Thread Naoto Sato
On Wed, 21 May 2025 06:12:18 GMT, Justin Lu wrote: >> Naoto Sato has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Reflects review comments > > src/java.base/share/classes/java/io/Console.java line 67: > >> 65: * stdout.encoding}, in whi

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

2025-05-21 Thread Naoto Sato
On Wed, 21 May 2025 16:53:53 GMT, Naoto Sato wrote: >> Indeed there *are* `stdout.encoding` tests in `test/jdk/java/io/Console`, >> yet none1 that thoroughly tests them with `expect` and a >> dedicated (mock) `CharsetProvider` as you did here. FWIW, I really liked >> your new test using a mock

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

2025-05-21 Thread Naoto Sato
On Wed, 21 May 2025 08:30:26 GMT, Volkan Yazici wrote: >> `stdout.encoding` validity is tested through the public `charset()` mehtod, >> which is in `CharsetTest.java` > > Indeed there *are* `stdout.encoding` tests in `test/jdk/java/io/Console`, yet > none1 that thoroughly tests them with `expe

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

2025-05-21 Thread Naoto Sato
On Wed, 21 May 2025 08:20:50 GMT, Volkan Yazici wrote: >> JLine is a 3rd party library. It would be desirable that they change their >> implementation to separately handle in/out in their terminal, but that is >> out of scope of this PR > > Created jline/jline3#1282. Thanks! - PR

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

2025-05-21 Thread Naoto Sato
> `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

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

2025-05-21 Thread Volkan Yazici
On Tue, 20 May 2025 22:04:41 GMT, Naoto Sato wrote: >> test/jdk/java/io/Console/StdinEncodingTest.java line 46: >> >>> 44: * @run junit StdinEncodingTest >>> 45: */ >>> 46: public class StdinEncodingTest { >> >> AFAICT, there is no similar test (e.g., one using a mock `CharsetProvider`) >> f

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

2025-05-21 Thread Volkan Yazici
On Tue, 20 May 2025 22:04:24 GMT, Naoto Sato wrote: >> All `FileDescriptor.in` encounters in `jdk.internal.org.jline.terminal` that >> might need attention: >> >> src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/DumbTerminalProvider.java >> src/jdk.internal.le/share/classe

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

2025-05-20 Thread Justin Lu
On Tue, 20 May 2025 21:57:45 GMT, Naoto Sato wrote: >> `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 >> diff

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

2025-05-20 Thread Naoto Sato
On Tue, 20 May 2025 11:29:42 GMT, Volkan Yazici wrote: >> Naoto Sato has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Reflects review comments > > test/jdk/java/io/Console/StdinEncodingTest.java line 46: > >> 44: * @run junit StdinEncod

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

2025-05-20 Thread Naoto Sato
On Tue, 20 May 2025 19:24:16 GMT, Volkan Yazici wrote: >> Also noticed `DumbTerminalProvider::sysTerminal` calls `DumbTerminal` with >> `new FileInputStream(FileDescriptor.in)`. Later on `DumbTerminal` applies >> `encoding()` both for passed `stdin` and `std{out,err}`. In short, >> `TerminalPr

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

2025-05-20 Thread Naoto Sato
> `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

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

2025-05-20 Thread Volkan Yazici
On Tue, 20 May 2025 19:18:43 GMT, Volkan Yazici wrote: >> src/jdk.internal.le/share/classes/jdk/internal/org/jline/JdkConsoleProviderImpl.java >> line 160: >> >>> 158: >>> 159: try { >>> 160: Terminal terminal = >>> TerminalBuilder.builder().encoding(outCharset) >>

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

2025-05-20 Thread Volkan Yazici
On Tue, 20 May 2025 10:40:39 GMT, Volkan Yazici wrote: >> `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 >> d

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

2025-05-20 Thread Volkan Yazici
On Fri, 16 May 2025 18:11:39 GMT, Naoto Sato wrote: > `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 > differen

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

2025-05-16 Thread Naoto Sato
`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 cas