JavaFX, Alt+Num (0-127) different for Java 7u80 (gibberish) vs Java 8u202 (normal ASCII), both default chatset UTF-8

49 views Asked by At

I have an ooold JavaFX project (2015), where I have to add scanner functionality. Scanner typically sends characters through a sequence of ALT+Num. For example ALT+(Num5 followed by Num0) results in character representing 2. This very same behavior happens by hitting Keyboard buttons. Problem is unrelated to the scanner. I will explain later down why. Keyboard layout is US throughout the whole testing and running stuff.

This works flawlessly when compiled in Java 8 (oracle archive, update 202 under). But in Java 7 (oracle archive, update 80) returns weird characters. I didn't recognize those, nor as any human languange, nor as ascii (or extended ascii https://www.asciitable.com/).

  • Java 8: 1;2;3;4;5;6;7;8;23.266.007 (being proper)
  • Java 7: “ß|߇ߒßߨß+ß¾ß|‡r|¨¨rˆˆ+ (being wrong)

Characters are retrieved by event filter KeyEvent.KEY_TYPED, keyEvent.getCharacter()

Compiled with IntelliJ IDEA. Win11,

  • Java 7 with language level "7 - Diamonds".
  • Java 8 with language level "8 - Lambdas".

Is there anything in combination JavaFX 2.2.3 with Java7 vs Java8 which could possibly change the basic ASCII table into something else?

First thing I checked was Charset.defaultCharset(), but that returned UTF-8 for both java versions. Even though the scanner is used only to scan Numbers, . (dot), / (slash) and - (minus) from the very basic 127 first characters of ASCII, so that wouldn't be affected by code page? Doesn't matter if scanned by device or typed from keyboard.

Scanner explanation: Regardless of Java version, scanner does input (ALT + Num5 + Num5). But in case of Java 8 it's ASCII '7' as expected. In the Java7 it's a '+' if I remember correctly. Even if I use the keyboard and Alt+Num5+Num5 method, I get the same characters as the scanner does, for each Java version.

I did an additional test with the Java 7 and a notepad window. Notepad showed the scanned numbers in the correct format 12.345.678, but the java application had complete gibberish.

Thanks for any advice!

0

There are 0 answers