These methods in this gist worked for me on my U.S.-based keyboard layouts. I am unsure about other layouts. If you have problems, revert your changes; delete the registry key you created (and reboot).
Update: you should probably scroll down to approach 4 where I suggest using Microsoft PowerToys Keyboard Manager.
Navigate to and create a new binary value in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout
named Scancode Map
.