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

Application.getParameters.getRaw returns an empty list as soon as the file path it should convey contains non latin characters

XMLWordPrintable

        This affects SceneBuilder as well as any self contained FX application which put in place a file association at installation time.
        In the case of SceneBuilder the user double clicks an FXML file and thanks the file association the path of the file is put into the parameters array.
        Extract of SB's code where I temporarily add the writing of debug.out in order to easier read what comes in:

            @Override
            public void start(Stage primaryStage) {
                String[] args = new String[getParameters().getRaw().size()];
                args = getParameters().getRaw().toArray(args);
                File out = new File("C:\\debug.out"); // GLOP
                try (FileWriter fw = new FileWriter(out, true)) {
                    fw.write("Default Locale = " + Locale.getDefault() + "\n");
                    fw.write("args = \n");
                    for (String item : args) {
                        fw.write("\t" + item + "\n");
                    }
                } catch (IOException ex) {
                    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                }
            [...]

        When the FXML file path is C:\Documents and Settings\Ken\My Documents\toto.fxml the arguments are correct (see attached debug1.out).
        But when I move the FXML file to C:\Documents and Settings\Ken\My Documents\新建文件夹\toto.fxml then the arguments list is empty (see attached debug2.out and the screen capture).

        I tried on a Chinese Windows XP and the issue might occur as well on other Windows flavors, Linux and MacOS as soon as the locale is Chinese, Japanese and similar.

          1. debug1.out
            0.0 kB
          2. debug2.out
            0.1 kB
          3. 未命名.PNG
            未命名.PNG
            38 kB

              cbensen Chris Bensen (Inactive)
              yjoan Yves Joan (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported: