Disclaimer: I do not accept responsibility for any issues arising from scripts being run without adequate understanding. It is the user's responsibility to review and assess any code before execution. More information

When RDP Thinks Your UK Keyboard Is American (plus some fun)


Anyone who works across multiple machines or remote sessions has likely seen this: you log into an RDP session, all your settings say English (United Kingdom), your local keyboard behaves perfectly… and suddenly: Shift + ' produces @, Shift + 2 produces ".

The UK vs US layout chaos is real.

This post explains:

  • Why this happens
  • How to confirm it’s really your keyboard vs RDP quirks
  • How to view scan codes using Event Viewer
  • How to remap keys with the Windows Scancode Map
  • Fun examples like swapping QWERTY → ASDFGH

1. Background — Everything Looked Correct

On the local machine:

  • Language: English (United Kingdom)
  • Keyboard Layout: United Kingdom
  • Input Method Tips: 0809:00000809

Physical keyboard: UK, confirmed by the £ symbol and tall Enter key.

Locally? Perfect.
Remotely via RDP? Suddenly behaving like a US keyboard.

2. The Cause — RDP’s Hidden US Fallback

Even with UK locale settings, RDP sometimes:

  • Misdetects the client keyboard
  • Applies a default US scancode map
  • Loads before IME / input methods apply
  • Or ignores HKCU\Keyboard Layout\Preload

Result: your keys don’t match the physical keyboard, even though Windows says everything is correct.

The solution? Take control at the scan code level.

3. How to Find a Key’s Scan Code (Using Event Viewer)

Windows receives hardware scan codes for every key press. You can view these without installing anything.

3.1 Open Event Viewer

Win + R → eventvwr.msc

3.2 Navigate to

Applications and Services Logs  
→ Microsoft  
→ Windows  
→ HIDClass  
→ Operational

3.3 Enable the log

Right-click Operational → Enable Log.

3.4 Press a key

Click back into Notepad, press the key, then refresh Event Viewer.

You’ll see entries like:

HID Keyboard Input Report
Scan Code: 0x1F

  • This is the hardware scan code for the key.
  • S in this example → 0x1F.

This is the value you use for the Scancode Map.

4. Understanding the Scancode Map Registry Key

Windows stores keyboard remaps in:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout

Value: Scancode Map (binary)

Structure of the binary:

PartBytesMeaning
Header800 00 00 00 00 00 00 00 (fixed)
Mappings Count4Number of mappings + 1 (for terminator)
Mappings4 bytes per mapping[NewScanCode][OldScanCode]
Terminator400 00 00 00

Important: [New][Old] format — Windows reads the old scan code from hardware and substitutes the new scan code.

5. Step Three — Example: Remap S → A

  • S = 1F
  • A = 1E

Binary mapping: 1E 00 1F 00

Full registry value:

Scancode Map=hex:00,00,00,00,00,00,00,00,02,00,00,00,1E,00,1F,00,00,00,00,00

  • Header: 00 00 00 00 00 00 00 00
  • Count: 02 00 00 00 (1 mapping + terminator)
  • Mapping: 1E 00 1F 00 (S → A)
  • Terminator: 00 00 00 00

Reboot → press S → outputs A.

Undo by deleting Scancode Map and rebooting.

6. Fixing the @ and " Key Problem

UK layout:

  • Shift + ' → @
  • Shift + 2 → "

US layout:

  • Shift + 2 → @
  • Shift + ' → "

Scancode Map swap:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,03,00,28,00,28,00,03,00,00,00,00,00

Reboot → restored UK behaviour even in RDP.

7. Advanced / Fun Remaps

7.1 QWERTY → ASDFGH

KeyScan CodeMap ToScan Code
Q10A1E
W11S1F
E12D20
R13F21
T14G22
Y15H23

Registry example:

Scancode Map=hex:00,00,00,00,00,00,00,00,07,00,00,00,10,00,1E,00,11,00,1F,00,12,00,20,00,13,00,21,00,14,00,22,00,15,00,23,00,00,00,00,00

7.2 Caps Lock → Escape

Scancode Map=hex:00,00,00,00,00,00,00,00,02,00,00,00,01,00,3A,00,00,00,00,00

7.3 Disable a key entirely (Right Windows key)

Scancode Map=hex:00,00,00,00,00,00,00,00,02,00,00,00,00,00,E0,5C,00,00,00,00

8. How Windows Handles 101 Keys vs The Registry Map

  • The registry does not list all keys
  • Windows already knows all scan codes from the keyboard driver and layout DLL
  • Scancode Map is just a set of exceptions: “override these hardware codes with these new codes”
  • Any scan code not in the registry → handled normally by system layout

This explains why you can remap a single key or a row of keys without specifying all 101 keys.

Conclusion

This issue started with a simple problem: RDP misinterpreting a perfectly normal UK keyboard.

The fix:

  • Find the scan code of the keys using Event Viewer
  • Build a ScanCode Map registry entry
  • Reboot → Windows applies the remaps globally
  • Optional: have fun remapping other keys, swapping rows, disabling keys, or creating Easter eggs

Key takeaway: the registry entry does not replace the full keyboard layout; it just tells Windows “when you see this scan code, pretend it’s that scan code instead.”

Once you understand this, you can fix RDP quirks and get creative with your keyboard.

Previous Post Next Post

نموذج الاتصال