It is a bug in Windows that existed for ages and still exists.
In this article by M. Kaplan from 2012 he explains the messy state of access to key names in Windows. There doesn't seem to be a lot of improvement on that front though.
The key names are stored in the compiled keyboard layout files which are DLLs, in their .data
section in a proprietary format exported as KbdLayerDescriptor
. The German keyboard layout is stored in C:\Windows\System32\KBDGR.DLL
. If you use the strings
utility on it, you will get this (yes the order is weird):
...
NACH-LINKS
^ZIRKUMFLEX
NACH-RECHTS
STRG-RECHTS
LINKE WINDOWS
NUM-FESTSTELL
RECHTE WINDOWS
BILD-NACH-OBEN
BILD-NACH-UNTEN
UMSCHALT RECHTS
ROLLEN-FESTSTELL
(ZEHNERTASTATUR) <<<<<< THE ISSUE EXISTS
(ZEHNERTASTATUR) <<<<<< HERE AS WELL!
0 (ZEHNERTASTATUR)
3 (ZEHNERTASTATUR)
2 (ZEHNERTASTATUR)
1 (ZEHNERTASTATUR)
+ (ZEHNERTASTATUR)
6 (ZEHNERTASTATUR)
5 (ZEHNERTASTATUR)
4 (ZEHNERTASTATUR)
...
We can verify that this is not a bug in how strings
' heuristics determine the start and the end of the string by looking at it in a hex editor:
As you can see there is no *
or /
existing in the file at all.
So it seems you are stuck with the bad names Windows gives you. (There are also bugs in other languages by the way.) Even the Windows shell itself exhibits this problem, for example this is what happens when I open the properties of a shortcut and attempt to set the hotkey to Num *:
I'm afraid you either have to put up with it or maintain your own list of fixes to apply to the broken info you get, or your own separate list of key names entirely, with corresponding translations... This is what other applications seem to do, VS Code for example.
(Of course if this affects only you or a small number of people, you could go to the lengths of creating a custom keyboard layout using the Microsoft Keyboard Layout Creator and set the name there correctly, but this may cause too much collateral damage (e.g. Microsoft account settings syncing issues) to be worth it.)
Num *
. Only German seems affected. – Cappello