How are people getting string inputs from users?

I have a requirement for getting a string input from the user, and wanted to know how other people are doing it.

Given that the KeyboardState class doesn’t take keyboard layout into consideration, how do you get the user to input their name for a high-score table?

My UI contains KeyboardLayout class, which is translation table from Keys enum to character. If you want just simple name input for high-score, i would just ignore special characters (with shift etc.) and catch only A-Z 0-9 + space and backspace.

That works fine for a US/UK QWERTY layout but how do you detect the French AZERTY layout or the German QWERTZ?

Well you check what’s the user CultureInfo.CurrentCulture (or directly CultureInfo.KeyboardLayoutId if you can) and based on that you have to use different translation table. So for example Keys.Q, will be char ‘Q’ for US/UK, but char ‘A’ for french.