JDK-8089894 : Mac: key codes for non-US English keyboard layouts may be incorrect
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: 8
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2013-12-20
  • Updated: 2023-12-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
This is a follow-up for a MS Windows-specific bug RT-32300. Note that the AWT/Swing in JDK suffer from the same bug as well.

The keys corresponding to Window's VK_OEM_1 ... VK_OEM_7 ( ;: + , - . /? `~ [{ \| }] '" ) always generate the following key codes on Mac:

        case 0x29:                                                                                                                                                                                       
        case 0x18:                                                                                                                                                                                       
        case 0x2B:                                                                                                                                                                                       
        case 0x1B:                                                                                                                                                                                       
        case 0x2F:                                                                                                                                                                                       
        case 0x2C:                                                                                                                                                                                       
        case 0x32:                                                                                                                                                                                       
        case 0x21:                                                                                                                                                                                       
        case 0x2A:                                                                                                                                                                                       
        case 0x1E:                                                                                                                                                                                       
        case 0x27:

Note that I was unable to find keys that would generate the VK_OEM_8 and VK_OEM_102 on my keyboard.

The value of the characters: property depends on the key and the event:

1. For regular keys it contains the actual character for the current keyboard layout. E.g. it is the + character for the }] key when the German layout is active.

2. For dead keys: the keyDown: provides an empty characters: array. The keyUp:, however, gives the symbolic representation of the dead key released.

Another issue is that, for example, in German layout the Z and Y keys are switched. The characters: for both keyDown: and keyUp: provides the correct values, but the keyCode is wrong when the German layout is active (it reports the Z keyCode for the key that generates the 'Y' character).
Comments
A couple of links worth investigating: http://www.cocoabuilder.com/archive/cocoa/30726-recognizing-key-events-for-accents.html http://www.cocoabuilder.com/archive/cocoa/214973-getting-accented-characters-in-cocoa.html
20-12-2013