Hi,

The list is used to test the inputReader and errorReader methods that accept a Charset.

The child process is launched with -Dsun.stdout.encoding and -Dsun.stderr.encoding to make the child encode its output in the requested charset (overriding the native encoding).
Then the parent reads the output with the same charset.
The test will be skipped if the encoding is not supported.

The test for the native charset uses only the native encoding in the default configuration.

Thanks, Roger

On 5/20/21 5:30 PM, Bernd Eckenfels wrote:
Hello,

Hm, how is that list used? - StandardCharaet.ISO_8859_1 is a guaranteed Charset 
for JVM, and since the encoding is done in Java it should be fine. Added 
benefit is, it’s 8bit transparent.

As for OS there is not a single standard charset (ebcdic vs latin families) but 
ASCII is probably the widest available (with latin1 variants to follow)


--
https://Bernd.eckenfels.net
________________________________
From: core-libs-dev <core-libs-dev-r...@openjdk.java.net> on behalf of Roger Riggs 
<rri...@openjdk.java.net>
Sent: Thursday, May 20, 2021 10:52 PM
To: core-libs-dev@openjdk.java.net
Subject: Re: RFR: 8191441: (Process) add Readers and Writer access to 
java.lang.Process streams

On Thu, 20 May 2021 20:42:35 GMT, Naoto Sato <na...@openjdk.org> wrote:

Methods are added to java.lang.Process to read and write characters and lines 
from and to a spawned Process.
The Charset used to encode and decode characters to bytes can be specified or 
use the
operating system native encoding as is available from the "native.encoding" 
system property.
test/jdk/java/lang/ProcessBuilder/ReaderWriterTest.java line 64:

62:         return new Object[][] {
63:                 {"UTF-8"},
64:                 {"ISO8859-1"},
`ISO8859-1` may not be available on all underlying OSes.
Is there a safe subset?
I haven't seen a failure yet, if/when it occurs, we make an exception or narrow 
the test to known systems.

test/jdk/java/lang/ProcessBuilder/ReaderWriterTest.java line 111:

109:     @Test(dataProvider = "CharsetCases", enabled = true)
110:     void testCase(String nativeEncoding) throws IOException {
111:         String osName = 
System.getProperty("os.name").toLowerCase(Locale.ROOT);
Not used anywhere else.
Right, dead code now without host dependencies.

test/jdk/java/lang/ProcessBuilder/ReaderWriterTest.java line 122:

120:                 "ReaderWriterTest$ChildWithCharset");
121:         var env = pb.environment();
122:         env.put("LANG", "en_US." + cleanCSName);
Does this work on Windows?
Should be removed, the tests work because they set sun.stdout/stderr.encoding.

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

PR: https://git.openjdk.java.net/jdk/pull/4134

Reply via email to