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

non-ascii chars in file can not be read or displayed when doubleclick a jar file

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 7
    • core-libs

      FULL PRODUCT VERSION :
      java version " 1.7.0_12-ea "
      Java(TM) SE Runtime Environment (build 1.7.0_12-ea-b07)
      Java HotSpot(TM) 64-Bit Server VM (build 24.0-b28, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      ProductName:Mac OS X
      ProductVersion:10.8.2
      BuildVersion:12C60

      A DESCRIPTION OF THE PROBLEM :
      when launching an java application by double-clicking a jar file, all non-ascii chars can not be read or displayed causing files to not load, files not found.
      This is related to an already fixed bug: ID 7193966
      Same problem when using JavaAppLauncher in bundled Mac OS X application.


      REGRESSION. Last worked in version 7

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a jar file that can be launched with " java -jar file.jar " ( " Main-Class: " section in manifest) or an application bundle using JavaAppLauncher (jdk/src/macosx/bundle/JavaAppLauncher) and launch it in Finder via double-click.
      You can open a JFileChooser and try to display non-ascii filenames.




      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The non-ascii filenames should be displayed correctly.
      ACTUAL -
      All non-ascii filenames are displayed with " ? " instead of the correct character.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.event.ActionEvent;

      import javax.swing.AbstractAction;
      import javax.swing.JButton;
      import javax.swing.JFileChooser;
      import javax.swing.JFrame;

      public class FileTest
      {
          public static void main(String[] args)
          {
              final JFrame frame = new JFrame( " testFileChooser " );
              
              JButton fcBut = new JButton(new AbstractAction( " Open& " )
              {
                  @Override
                  public void actionPerformed(ActionEvent e)
                  {
                      JFileChooser jfc = new JFileChooser();
                      int ret = jfc.showOpenDialog(frame);
                      if(ret == JFileChooser.APPROVE_OPTION)
                      {
                          System.err.println( " FC approve: " +jfc.getSelectedFile());
                      }
                  }
              });
              frame.add(fcBut);
              
              frame.setSize(300, 300);
              frame.setVisible(true);
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      For JAR launch there is a workaround:
      - launch the JAR file via Terminal app: java -jar file.jar (By default LANG is set to something like LANG=de_DE.UTF-8)

      For launching an application bundle you have to change the native code of the JavaAppLauncher.

            bchristi Brent Christian
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: