- Describe the bug. Describe what is happening when the bug occurs. Describe what you would normally expect to occur.
When a keyboard layout is configured to have certain dead keys, such as the US-International layout in Windows 10, KeyCodes that map to dead keys will actually behave like a dead key (and the effect of pressing this dead key becomes visible when the user presses another key on the keyboard, or when
GetStringForKeyCode is called again). This is unexpected behavior, simply outputting the actual dead key string is expected instead.
This is best illustrated through an example. Set the keyboard layout to US-International, then run this in the command bar:
> print(("'%s' then '%s'"):format(game:GetService("UserInputService"):GetStringForKeyCode(Enum.KeyCode.Backquote), game:GetService("UserInputService"):GetStringForKeyCode(Enum.KeyCode.A))) '' then 'À'
Note how the first call to
GetStringForKeyCode with a backtick yields an empty string. The second call, with “A”, will now return A with a diacritic (“À”) due to the previously pressed dead key.
game:GetService("UserInputService"):GetStringForKeyCode(Enum.KeyCode.Backquote) will return an empty string, but if the user would start typing somewhere, the dead key still has an effect on the first key the user presses (even though the user didn’t press the dead key themself).
Changing the keyboard layout to a layout that does not have the backquote as a dead key will result in expected behavior, such as the regular US layout:
> print(("'%s' then '%s'"):format(game:GetService("UserInputService"):GetStringForKeyCode(Enum.KeyCode.Backquote), game:GetService("UserInputService"):GetStringForKeyCode(Enum.KeyCode.A))) '`' then 'A'
The same output is expected for the US-International layout.
If the user presses a dead key themself and then
GetStringForKeyCode gets called, then the dead key will have an effect on
GetStringForKeyCode's output as well (which also is unexpected behavior, of course).
- How often does the bug happen (Everytime/sometimes/rarely)? What are the steps that reproduce the bug? Please list them in very high detail. Provide simple example places that exhibit the bug and provide description of what you believe should be the behavior.
Always, see above.
- Where does the bug happen (www, gametest, etc) Is it level-specific? Is it game specific? Please post a link to the place that exhibits the issue.
- Would a screenshot or video help describe it to someone? If so, post one.
- For graphics bugs, it is sometimes helpful to know your system specs, especially graphics card.
Windows 10, tested with US-International and US keyboard layouts.
- When did the bug start happening? If we can tie it to a specific release that helps us figure out what we broke.
GetStringForKeyCode got introduced.
- Anything else that you would want to know about the bug if it were your job to find and fix it.