Apple magic keyboard weird behavior
I'm going to defer to people like @nohillside and @Tom Gewecke for internationalization and keyboard setups, but you can rule out a factory reset of Apple bluetooth devices quite quickly assuming you have a Mac computer you can borrow and pair to the keyboard in question.
- Enable Bluetooth in the menu bar
- Hold Shift and Option keys when you click on Bluetooth icon (and you can let go of the modifier keys once the menu is visible).
- Choose Debug - Factory reset all connected Apple devices or choose the specific device - navigate to the sub menu and choose Factory Reset
I'm guessing this is less than 50% your issue, but if it does - you'll be set (or have fewer items to chase down) and know how to reset Apple Bluetooth devices.