PSReadLine
PSReadLine copied to clipboard
Some keys on Japanese layout keyboards are incorrectly interpreted as @
Environment
PS version: 7.1.1
PSReadline version: 2.1.0
os: 10.0.19041.800 (WinBuild.160101.0800)
PS file version: 7.1.1.0
HostName: ConsoleHost (Windows Terminal)
BufferWidth: 120
BufferHeight: 30
Exception report
N/A
Steps to reproduce
- Open powershell with Japanese layout keyboard.
- Press "無変換(Muhenkan)" key on keyboard.
Expected behavior
This is not character key - so nothing should happen and be displayed in console.
Actual behavior
Console prints @ key.
Backgrounds
I ran [console]::ReadKey() in pwsh and press "無変換(Muhenkan)" key.
KeyChar Key Modifiers
------- --- ---------
29 0
Japanese is not an alphabet, so I use an IME - Input Method Editor (e.g. Microsoft IME) to type it. The "Muhenkan" key is for IME operation, so it does not send any characters.
It didn't occur with the "半角/全角(Hankaku/Zenkaku)" key and the "変換(Henkan)" key for operating Japanese IME. However, if I press it together with the ALT key, the "@" will be displayed like "Muhenkan" key.
I'm having the same problem. I hope it will be resolved as soon as possible.
https://github.com/PowerShell/PSReadLine/blob/ad74cef2501709d2a60a58f61d7cac32d185209f/PSReadLine/Keys.cs#L295-L302
I'm facing the same problem. This practice is not only ugly but also problematic.
https://github.com/PowerShell/PSReadLine/blob/15850a4e2ec4c74e31c222403f741532a2f46571/PSReadLine/Keys.cs#L206-L220
To add 0x1D (29) here will solve the problem. On the other hand, that constant should be available as ConsoleKey.NonConvert or such, so I added an issue to the .NET framework.
I happened to find that using the new version of the Microsoft IME solve this problem in my environment. That IME had many bugs and I've used the previous version for a long time https://support.microsoft.com/en-us/windows/revert-to-a-previous-version-of-an-ime-input-method-editor-adcc9caa-17cb-44d8-b46e-f5b473b4dd77.
@hiro-mi and @tsukumijima Can you try the new version of Microsoft IME and see if that works for you too?
I have three PCs (two Win10 and one Win 11), and all the devices are now free from this problem thanks to the new version of Microsoft IME. The key code 29 is still sent (I checked that on https://keycode.info/), but the problem never happens. As @hiro-mi reported, with the Alt key, @ is still input. That doesn't matter for most of the people, I think, however.
I'm usually using Google Japanese Input. When I tried the new Microsoft-IME, pressing the "Muhenkan" key no longer typed "@". However, as mentioned earlier, the new Microsoft-IME has many bugs. I'm used to Google Japanese Input, so I don't think I'll switch to the new Microsoft-IME just for this.
On US layout keyboards, the "Hankaku/Zenkaku" key does not exist.
If you want to do the same, you need to type Alt + ` , in which case @ will be typed as well as Alt + Hankaku/Zenkaku.
This occurs not only with Google IME, but also with MS-IME.
We hope this will be fixed, as it is a key binding frequently used by Japanese users of US keyboards.
Just so I am understanding this correct, the MS IME provides different key handlers for keys not available on US keyboards and the problem is that PSReadLine is not recognizing them correctly? Is this issue still persistent with latest versions of MS IME and PSReadLine? There may be a need to unbind default key handlers that conflict
@StevenBucher98 I have tested with Powershell 7.3.3 and this issue continues to occur. My environment as output by "$PSVersionTable" is as follows
PSVersion 7.3.3
PSEdition Core
GitCommitId 7.3.3
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
However, the same Issue does not occur with the following versions in the same PC.
PSVersion 5.1.19041.2673
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.2673
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
The changes that were made between these versions may give some clues.
I am using the latest Microsoft IME and PowerShell version 7.3.5. The issue of producing @ character on US keyboard while using the key combinations Alt-~ or Ctrl-~ still remains and quite annoying. Will there be any progress on resolving this?