Describe the bug
Typing non-ASCII characters (such as Cyrillic) into the computer terminal results in random ASCII characters or garbage output. For example, typing "йцукен" outputs "9FC:5=".
This happens because the terminal keyboard handler or network packet seems to simply cast the Java UTF-16 char to a single byte (dropping the upper byte) instead of properly encoding the char into a UTF-8 byte array before sending it to the emulator's UART.
(For instance: 'й' is U+0439. Dropping the upper byte leaves 0x39, which is the ASCII character '9'.)
To Reproduce
Steps to reproduce the behavior:
- Singleplayer or multiplayer (happens on both).
- Place a Computer and boot up the Minux OS.
- Interact with the terminal / screen.
- Switch your physical keyboard layout to Russian (or any other non-ASCII language) and type йцукен.
- See error: The terminal displays 9FC:5= instead of properly handling the input.
Log files
No crash occurs. This is a logical encoding error, so logs do not contain relevant stack traces.
Expected behavior
When a charTyped event captures a non-ASCII character, it should be converted into a UTF-8 byte sequence (String.valueOf(char).getBytes(StandardCharsets.UTF_8)), and the resulting bytes should be sent sequentially to the terminal/UART. This would allow the guest OS to properly process UTF-8 input.
Versions:
Minecraft: 1.20.1
Forge: 47.4.10
oc2r: 2.2.13
Additional context
I loaded the LatArCyrHeb-16.psf font inside Minux, and $LANG is set to en_US.UTF-8, so the OS itself is capable of rendering the characters. The issue strictly lies in the Forge mod's input handling layer discarding the upper byte of the Java characters before they reach the virtual machine.
Describe the bug
Typing non-ASCII characters (such as Cyrillic) into the computer terminal results in random ASCII characters or garbage output. For example, typing "йцукен" outputs "9FC:5=".
This happens because the terminal keyboard handler or network packet seems to simply cast the Java UTF-16 char to a single byte (dropping the upper byte) instead of properly encoding the char into a UTF-8 byte array before sending it to the emulator's UART.
(For instance: 'й' is U+0439. Dropping the upper byte leaves 0x39, which is the ASCII character '9'.)
To Reproduce
Steps to reproduce the behavior:
Log files
No crash occurs. This is a logical encoding error, so logs do not contain relevant stack traces.
Expected behavior
When a charTyped event captures a non-ASCII character, it should be converted into a UTF-8 byte sequence (String.valueOf(char).getBytes(StandardCharsets.UTF_8)), and the resulting bytes should be sent sequentially to the terminal/UART. This would allow the guest OS to properly process UTF-8 input.
Versions:
Minecraft: 1.20.1
Forge: 47.4.10
oc2r: 2.2.13
Additional context
I loaded the LatArCyrHeb-16.psf font inside Minux, and $LANG is set to en_US.UTF-8, so the OS itself is capable of rendering the characters. The issue strictly lies in the Forge mod's input handling layer discarding the upper byte of the Java characters before they reach the virtual machine.