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

[macos] Problem with backslashes on macOS/JIS keyboard: Java ignores system settings

XMLWordPrintable

    • b01
    • b25
    • x86
    • os_x

        ADDITIONAL SYSTEM INFORMATION :
        macOS 10.13.6 (but other versions also have the same problem)

        A DESCRIPTION OF THE PROBLEM :
        Java apps ignore system settings regarding handling yen key.
        Yen key generated a different scancode than the backslash key, and macOS has settings to handle those correctly. Java apps seems to ignore that.

        There is a fix https://bugs.openjdk.java.net/browse/JDK-8191178 which tries to improve the handling of yen symbol, but actually it makes things worse for the backslash case, making impossible to input backslash at all in some cases.

        Please see https://youtrack.jetbrains.com/issue/JRE-572 for the further discussion.

        REGRESSION : Last worked in version 8u172

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        1. Install macOS 10.13 High Sierra, set system language to English
        2. Find a keyboard with JIS layout
        3. Add Japanese input source
        4. Change Settings -> Keyboard -> Input Sources -> Japanese -> "Â¥" key generates -> \ (Backslash)
        5. Change Input method to Romaji
        6. Check that other apps correctly interpret that key as backslash now
        7. Check that a Java app still interprets it as "yen"

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        See https://youtrack.jetbrains.com/issue/JRE-572#focus=streamItem-27-3178131-0-0
        ACTUAL -
        See https://youtrack.jetbrains.com/issue/JRE-572#focus=streamItem-27-3178131-0-0

        ---------- BEGIN SOURCE ----------
        import javax.swing.*;

        public class JTextFieldTest {
            public static void main(String[] args) {
                SwingUtilities.invokeLater(() -> {
                    JFrame f = new JFrame();
                    JTextField field = new JTextField(20);
                    f.add(field);
                    f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
                    f.pack();
                    f.setLocationRelativeTo(null);
                    f.setVisible(true);
                });
            }
        }
        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        Before the fix https://bugs.openjdk.java.net/browse/JDK-8191178 (checked with 8u202b03) it was possible to input backslash with Command+Yen, the fix breaks that behavior.

        FREQUENCY : always


              psadhukhan Prasanta Sadhukhan
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

                Created:
                Updated:
                Resolved: