JDK-8094058 : Apostrophe as dead key doesn't work on Windows 8.1 Latvian (Standard) keyboard layout
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: 8u20,8u25
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-01-13
  • Updated: 2015-06-12
  • Resolved: 2015-04-24
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.
JDK 8
8u60Fixed
Related Reports
Blocks :  
Duplicate :  
Relates :  
Description
Windows 8.1 comes with a "Latvian (Standard)" keyboard layout. Using apostrophe (') as a dead key should result (depending on the letter) in either a macron (������...), a cedilla (������...) or a caron (������...) being written.

Using Java FX 8u25 something like Latin letters with acute are produced. Using AltGr as a dead key works as expected. The character input works as expected in the Windows native applications (e.g. notepad) as well as in Java 8u25 Swing components.

Using Java FX 8u11 input works as expected.

Comments
Changesets: http://hg.openjdk.java.net/openjfx/8u-dev/rt/rev/f2411e237554 http://hg.openjdk.java.net/openjfx/9-dev/rt/rev/448e20d9999f
24-04-2015

> AltGr should also produce the same results. This is not working yet. The fix for RT-39464 (Greek kbd) has the same problem. I will file a separate bug for this.
24-04-2015

@Leif: This fix assumes that there is only one dead key on the Latvian (Standard) keyboard in Win 8.1 AltGr should also produce the same results.
24-04-2015

Sorry, I don't think we can add any special code in this fix to support these custom layouts. The fix is intended for Win 8.1 and the old MS layouts are supported for earlier Win versions. You could file a new issue for further support, but I'm afraid it won't be given very high priority.
24-04-2015

I am installing it from binary form. There are these lines of code in src files: DESCRIPTIONS 0409 Latvian (Apostrofs v1.0; komats) LANGUAGENAMES 0409 Latvian (Latvia) Could it be some kind of identification? If no, I can try to contact author of apostrofs and ask if he can assist you in any way. But apostrofs is not the only custom layout. There is at-least one more. It is commercial though.
24-04-2015

I looked at some other klc files and I don't think there is a way to specify the kbd id. The only other way would be for us to load the keyboard name and do a string compare. I'd rather not add that kind of complexity now though. The only info I have found on the subject is that "the high word contains a device handle to the physical layout of the keyboard". https://msdn.microsoft.com/en-us/library/windows/desktop/ms646296%28v=vs.85%29.aspx https://msdn.microsoft.com/en-us/library/windows/desktop/ms646298%28v=vs.85%29.aspx
24-04-2015

That's a good point. I don't think it will work with the custom layouts. I looked at the sources and I don't see any keyboard identifier specified. I don't know how Windows assigns one and I don't know how else I could recognize these specific layouts. Are you downloading apostrofs in binary form, or are you installing it from those source files? Maybe there is a way to modify them to add the same kbd id that 8.1 uses?.
24-04-2015

OK I think I'll wait till beta is available. What makes me worried is this line of code: ... } else if (HIWORD(m_kbLayout) == 0xf0b1 && LOBYTE(m_idLang) == LANG_LATVIAN) { ... Will it match custom kbd layouts on windows 7 and older? Here are the src files for one of the custom layouts (if that can help you in any way): https://github.com/laacz/apostrofs
24-04-2015

The only way to test it now is if you can build OpenJFX yourself. This requires some recent version of Visual Studio plus a few free software components. See https://wiki.openjdk.java.net/display/OpenJFX/Building+OpenJFX Otherwise, I think we'll have this ready in 8u60 ea b13 in a couple of weeks, so you can try it then. We will still be able to make minor tweaks then if necessary.
24-04-2015

Is there a way I can test it? I could test it on windows 7 with custom kbd layout installed.
24-04-2015

+1 Looks good. Works on my Windows 8.1 laptop with Latvian keyboard layout enabled.
24-04-2015

+1
23-04-2015

Webrev for review: http://cr.openjdk.java.net/~leifs/rt39804/webrev.01/ This fix assumes that there is only one dead key on the Latvian (Standard) keyboard in Win 8.1. Please correct me if I'm wrong. I found that the "old" Latvian (QWERTY) keyboard on Win 7 has a dead key for �� to create letters like ��. I added a case for this to the default dead key table.
23-04-2015

@Ojars: Thanks for the map. I agree that using the system handler would be much better, but unfortunately we depend on being able to decode KeyUp/Down events and doing this causes the kbd status to be reset and break the system handler. See evaluation starting with https://javafx-jira.kenai.com/browse/RT-35261?focusedCommentId=402802&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-402802 I agree with David that the "common" Latin table should cover most languages that use 8859-1, but we will need to test as many of them as possible. The Latvian (Standard) kbd is special since it produces different results for different letters. I will start working on getting the Latvian table added and will hopefully be able to get it in for 8u60. Time is running short.
22-04-2015

after a quick look for how others handle this, I found: GTK: https://help.ubuntu.com/community/GtkDeadKeyTable MSDN: https://msdn.microsoft.com/en-us/library/cc195155.aspx I was curious because of the need for Greek as a separate table. It turns out Greek is an exception shown in both links. This is slowly making sense to me because I finally remembered that Greek is ISO8859-7, and so will need keys beyond the Latin charset 8859-1. What is still unclear to me is if the "common" Latin table plus the greek table is enough for Latvia and eastern Europe. If it is - then perhaps with a known scope of tables this is a good long term solution after all.
22-04-2015

It's quite a long time since this bug exists so it's very sad that you changed fix version to 9 (we can't use javaFX for Latvian language input). When do you expect version 9 to be published?
22-04-2015

I think it is not a good solution to hardcode specific keyboard layouts, but you should rely on the default system handler. The same problem probably exists also for all other keyboard layouts, Lithuanian, Norwegian, German, etc. Combining character map: ||Glyph||Glyph Description||Code||Code Description||Combining||Combining Description||Latin Extended-A (Precomposed character)|| |�� |Latin Capital Letter A with macron|U+0041 |Latin Capital letter A |U+00AF|Macron|U+0100 | |�� |Latin Small Letter A with macron|U+0061 |Latin Small Letter A |U+00AF|Macron|U+0101 | |�� |Latin Capital Letter C with caron|U+0043 |Latin Capital letter C |U+02C7|Caron|U+010C | |�� |Latin Small Letter C with caron|U+0063 |Latin Small Letter C |U+02C7|Caron|U+010D | |�� |Latin Capital Letter E with macron|U+0045 |Latin Capital letter E |U+00AF|Macron|U+0112 | |�� |Latin Small Letter E with macron|U+0065 |Latin Small Letter E |U+00AF|Macron|U+0113 | |�� |Latin Capital Letter G with cedilla|U+0047 |Latin Capital letter G |U+00B8|Cedilla|U+0122 | |�� |Latin Small Letter G with cedilla|U+0067 |Latin Small Letter G |U+00B8|Cedilla|U+0123 | |�� |Latin Capital Letter I with macron|U+0049 |Latin Capital letter I |U+00AF|Macron|U+012A | |�� |Latin Small Letter I with macron|U+0069 |Latin Small Letter I |U+00AF|Macron|U+012B | |�� |Latin Capital Letter K with cedilla|U+004B |Latin Capital letter K |U+00B8|Cedilla|U+0136 | |�� |Latin Small Letter K with cedilla|U+006B |Latin Small Letter K |U+00B8|Cedilla|U+0137 | |�� |Latin Capital Letter L with cedilla|U+004C |Latin Capital letter L |U+00B8|Cedilla|U+013B | |�� |Latin Small Letter L with cedilla|U+006C |Latin Small Letter L |U+00B8|Cedilla|U+013C | |�� |Latin Capital Letter N with cedilla|U+004E |Latin Capital letter N |U+00B8|Cedilla|U+0145 | |�� |Latin Small Letter N with cedilla|U+006E |Latin Small Letter N |U+00B8|Cedilla|U+0146 | |�� |Latin Capital Letter S with caron|U+0053 |Latin Capital letter S |U+02C7|Caron|U+0160 | |�� |Latin Small Letter S with caron|U+0073 |Latin Small Letter S |U+02C7|Caron|U+0161 | |�� |Latin Capital Letter U with macron|U+0055 |Latin Capital letter U |U+00AF|Macron|U+016A | |�� |Latin Small Letter U with macron|U+0075 |Latin Small Letter U |U+00AF|Macron|U+016B | |�� |Latin Capital Letter Z with caron|U+005A |Latin Capital letter Z |U+02C7|Caron|U+017D | |�� |Latin Small Letter Z with caron|U+007A |Latin Small Letter Z |U+02C7|Caron|U+017E | http://en.wikipedia.org/wiki/Latvian_orthography
22-04-2015

Actually, we do have an identifier for the keyboard language and the physical layout, so it might be possible to create a table similar to the one created for RT-39464. I hope the layout id doesn't vary between actual keyboards and simulated ones, but if it's hard to pin down then we may be able to use the Windows function GetKeyboardLayoutName() instead. So, it could be good to start collecting a list describing the expected diacritical mark (known as combining character in Unicode) for each affected letter. Ojars, would you be able to help find a reference for this, or make one yourself?
21-04-2015

I can reproduce this on Win 8.1. I looked at the incoming codes for the dead key and the following typed key. They mostly fall within the ASCII range and are not distinguishable from any other Latin keyboard. This means that I can't use a similar fix to the one for Greek in RT-39464, where I can detect that the character to be accented is within the Greek alphabet. To fix this one, I would either need to figure out how to detect the kbd layout that is used and then make a table for all expected Latvian character combinations, or, as noted in RT-39464, find a way back to using the system dead key handler without undoing RT-35261. Unfortunately, I think it is too late to get either of these done for 8u60.
21-04-2015

"Latvian (Standard)" is a new keyboard layout for Windows 8.1 that enables apostrophe (') as a dead key. In previous Windows versions there is only "Latvian (QWERTY)" keyboard layout with AltGr as the default dead key. In order to use apostrophe (') as a dead key in previous Windows versions you have to install a custom keyboard layout. The problem is that many users historically are accustomed to use apostrophe instead of the AltGr.
21-04-2015

Is this layout new in Win 8 / 8.1 and not available for Win 7? I don't see the described (expected) behavior with native apps on Win 7, but I will try on 8.1 when I get a chance.
20-04-2015

Could you please provide some details or workaround. Until version 9 we could try to solve this with our custom JavaFX build.
19-01-2015