Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8232846

ProcessHandle.Info command with non-English shows question marks

    XMLWordPrintable

Details

    • b17
    • x86_64
    • windows_10

    Backports

      Description

        FULL PRODUCT VERSION :
        openjdk version "14-ea" 2020-03-17
        OpenJDK Runtime Environment (build 14-ea+17-721)
        OpenJDK 64-Bit Server VM (build 14-ea+17-721, mixed mode, sharing)

        ADDITIONAL OS VERSION INFORMATION :
        Windows 10 Japanese

        A DESCRIPTION OF THE PROBLEM :
        ProcessHandle.Info command shows question mark or garbled characters if the command is in non-English.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Execute the attached sample program in Japanese Windows.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        Expected
        C:\Temp\(Japanese Hiragana A x 3).exe

        Actual
        C:\Temp\????

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.io.*;
        import java.nio.*;
        import java.nio.file.*;
        import java.util.*;

        public class ProcessName{
            public static void main(String[] args) {
                try{
                    // Create Japanese named program for test
                    String test = "\u3042\u3042\u3042.exe"; // Japanese Hiragana AAA
                    String systemRoot = System.getenv("SystemRoot");
                    Path ping = Paths.get(systemRoot).resolve("system32").resolve("ping.exe");
                    Path target = Paths.get(test);
                    Files.copy(ping, target, StandardCopyOption.REPLACE_EXISTING);
                    Scanner keyboard = new Scanner(System.in);
                    System.out.print("Pree enter key:");
                    String input = keyboard.nextLine();

                    String[] cmd={test, "localhost"};
                    ProcessBuilder pb = new ProcessBuilder().command(cmd);
                    Process p = pb.start();
                    ProcessHandle.Info info = p.info();
                    System.out.println(info.command().get());
                }catch(IOException e){
                    e.printStackTrace();
                }
            }
        }
        ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

                tnakamura Toshio Nakamura
                tnakamura Toshio Nakamura
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: