Using Non-US English Keyboards with RDP
You can use non-US English keyboards on systems under test (SUTs) with Eggplant Functional and either Virtual Network Computing (VNC) or Remote Desktop Protocol (RDP) connection types. Information about how to use non-US English keyboards on SUTs with Eggplant Functional is provided below.
For additional information and alternative methods for using non-English keyboards with Eggplant Functional, see the FAQ article How do I use non-English keyboards with Eggplant Functional?
For VNC SUT Connections
Eggplant Functional support for using non-US English keyboards is built in to the VNC server. No special configuration is required to use non-US English keyboards on SUTs that you connect to with VNC.
For RDP SUT Connections
Eggplant Functional support for using non-US English keyboards with RDP SUT connections requires additional configuration depending on the language:
-
For French, German, and UK English languages, we provide the keyboard layout mapping. You configure it by selecting the language you want in Eggplant Functional and on the SUT as described in Using the Provided Languages below.
-
For other languages, you can create your own keyboard layout mapping file within Eggplant Functional as described in Creating a Keyboard Layout Mapping File below.
Detailed information about how to implement non-US English keyboards with either of these configurations is provided below.
Using the Provided Languages
If you want to use French, German, or UK English on a SUT that you are connecting to with RDP, you must configure the language as described here:
- Choose Control > RDP Keyboard Layout > and French, German, or UK English from the Eggplant Functional toolbar.
- Select the same language on the SUT when you connect to it.
In Live Mode, Eggplant Functional always uses the US English keyboard. Changing the keyboard setting only affects scripted keyboard actions (i.e. the typeText
command).
Using Other Languages
Eggplant Functional supports the use of languages in addition to the provided languages by giving you the option to create your own keyboard layout mappings file. When you choose to create a new layout mapping file, we create the file for you. You need to modify it with the key codes for the language you want.
Creating a Keyboard Layout Mapping File
Below are the things you need to know about creating a keyboard layout mappings file, along with the contents of a file that has been created but not edited. The following topics are covered:
- Step by Step: Creating a Keyboard Layout Mappings File
- Keyboard Layouts Mapping File Contents
- Keyboard Layout Mapping Files Requirements
- Keyboard Layout Mapping Format Examples
- Step by Step: Implementing a Keyboard Layout
Step by Step: Creating a Keyboard Layout Mapping File
To create a keyboard layout mapping file, perform the following steps:
-
Launch Eggplant Functional.
-
Choose Control > RDP Keyboard Layout > Create new. This opens the New Keyboard Layout window prompting you to name your new file and save it in the KeyboardLayouts directory, which is in your Eggplant Functional application directory structure. If you installed Eggplant Functional in the default installation directory, the KeyboardLayouts directory would be in one of the following locations:
- On Mac and Linux: ~/Library/Eggplant/KeyboardLayouts.
- On Windows: %APPDATA%/Eggplant/KeyboardLayouts.
-
Give your mappings file a name that is meaningful to you. For example, our French keyboard layout file is named "French.txt."
-
Save your mappings file as a text file with the .txt extension, which is the default. You
must
save the file as text file. -
After you save the file, you can locate it in the KeyboardLayouts directory and edit with a text editor.
noteYou need to repeat this process for each language you want to add.
Keyboard Layout Mappings File Contents
Below are the contents of a keyboard layout mappings file that has been created but not edited. It contains example code for configuring keys.
You must replace this sample code with the code for your language.
{
"~": {
"altFlag": "DOWN",
"scancode": 27,
"controlFlag": "DOWN"
},
"`": {
"shiftFlag": "DOWN",
"scancode": 13,
"altFlag": "UP",
"controlFlag": "UP"
},
"?": {
"shiftFlag": "DOWN",
"scancode": 12,
"altFlag": "UP",
"controlFlag": "UP"
},
"/": {
"shiftFlag": "DOWN",
"scancode": 8,
"altFlag": "UP",
"controlFlag": "UP"
},
"1": {
"scancode": 2
}
}
Keyboard Layout Mapping Files Requirements
Following are the Eggplant Functional requirements for the keyboard layout mapping file and mappings:
File Format Requirements
- You must create one mapping file for each language you want to add.
- Each mapping
file
must begin with the character { and end with the character }.
Key Mapping Requirements
- You need to include mappings in the file for only those characters that differ from the US keyboard key mappings. The US keyboard mapping is used for any character that is not mapped in the file.
- The mapping for each key must include the character you are mapping, a scan code, and flags for any required modifier keys. (The modifier keys are Alt, Shift, or Control (CTRL). You can omit flags for modifiers that are not required by the character. For example, the character # in the US keyboard requires the Shift key to be down, regardless of the state of other modifier keys. Hence, you don't need to include the other modifier keys (i.e., CTRL and Alt) as shown in the mapping in Example 2.
Keep in mind that each key has one scan code. But each key can have multiple mappings because it can be used for different characters. For example, the number 4 key on a US keyboard is also used for the # character when the Shift key is down. See examples 1 and 2 below.
Keyboard Layout Mapping Format Examples
Below are examples of key mappings in the format Eggplant Functional requires for non-US English keyboard layout mapping files. Explanations of the mappings follow.
Example 1
The first example uses the number 4 mapping from the Microsoft United States 101 Keyboard (Windows CE 5.0). You can look at the table on this United States 101 Keyboard page and compare it with the example below to see what a key mapping looks like in the Eggplant Functional format. This example shows the mapping for the number 4:
"4": {
"shiftFlag": "UP",
"scancode": 04
}
The format of the mapping is as follows:
"4"
the first item in the mapping is the character you are mapping."shiftFlag" : "UP",
indicates that this character requires that the Shift key be in the"UP"
position.- The comma following the modifier key flag, as shown above, delineates the flag, separating it from the next flag or, in this case, the scan code. The key modifier flags and the scan code must be separated by a comma, except the last one which must
not
have a comma. - The
"scancode"
is the scan code for the key (04
).
Note that the order of the "shiftFlag"
and "scancode,"
or any of the other modifier key flags, does not matter.
Example 2
The second example shows the mapping format for the hashtag (#) character from the same United States 101 keyboard referenced above. The # character is on the same key as the number 4 and has the same scan code. The position of the Shift key distinguishes the characters: the "shiftFlag"
position for the # character is "DOWN"
, whereas the it is "UP" for the number 4.
"#": {
"shiftFlag": "DOWN",
"scancode": 04
}
Example 3
The third example shows the curly brace ({) character mapping from our German keyboard layout. This mapping shows the use of the modifier key flags for the Alt key ("altFlag"
) and the Control (CTRL) key ("controlFlag"
) modifier keys.
"{": {
"shiftFlag": "UP",
"scancode": 8,
"altFlag": "DOWN",
"controlFlag": "DOWN"
}
Step by Step: Implementing a Keyboard Layout
After you create you create your keyboard layout mappings file, follow the steps below to implement the keyboard layout for your language in Eggplant Functional:
- After you save your edited mapping file, you must restart Eggplant Functional to implement it.
- Configure the new language in Eggplant Functional by choosing Control Menu > RDP Keyboard Layout > your_new_language, which is now an option in the keyboard layout menu.
- Connect to the SUT using RDP and set the same language on the SUT. (The previous two configuration steps are the same as those described in Using Provided Languages above. )
Your SUT should now be ready to test in the language you want.