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

Non-ASCII characters are not handled correctly in the native launcher

    XMLWordPrintable

Details

    • b27
    • x86_64
    • windows_10

    Backports

      Description

        ADDITIONAL SYSTEM INFORMATION :
        Only appears on Windows systems even my system local is in French

        A DESCRIPTION OF THE PROBLEM :
        Non-ASCII characters passed as arguments to the native launcher do not match those transmitted to the JVM.
        Example of an argument with french chars:
        $ app.exe mypath/élément.txt
        JVM args => mypath/élément.txt

        Therefore it is not possible to open files with non-ASCII characters by associating a mime type to the application.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        1) Create a class FooClient.java, fill with the content below.
        2) Add module-info.java:
        module app {
            requires java.desktop;
        }

        3) Build app.jar
        4) Build an installer: jpackage -n app -p C:\Users\myjarpath\target -m app/org.test.FooClient
        5) Install app-1.0.exe
        6) From cmd, run: app.exe mypath/élément.txt

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Result in JFrame: mypath/élément.txt
        ACTUAL -
        Result in JFrame: mypath/élément.txt

        ---------- BEGIN SOURCE ----------
        package org.test;

        import java.awt.BorderLayout;

        import javax.swing.*;

        public class FooClient {

            public static void main(String[] args) {
                javax.swing.SwingUtilities.invokeLater(() -> {
                    JFrame frame = new JFrame("Test non ascii chars through args");
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    JPanel panel = new JPanel();
                    BoxLayout boxLayout = new BoxLayout(panel, BoxLayout.Y_AXIS);
                    panel.setLayout(boxLayout);
                    
                    for (int i = 0; i < args.length; i++) {
                        JLabel jLabel = new JLabel(args[i]);
                        panel.add(jLabel);
                    }
                    frame.getContentPane().add(panel, BorderLayout.CENTER);
                    frame.pack();
                    frame.toFront();
                    frame.setVisible(true);
                });
            }
        }
        ---------- END SOURCE ----------

        FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

                asemenyuk Alexey Semenyuk
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: