How to change key value of <Alt> to 0x27 (i.e. <Meta>)? #13422

Closed
opened 2026-01-31 03:42:14 +00:00 by claunia · 8 comments
Owner

Originally created by @ParadoxZW on GitHub (Apr 14, 2021).

I've used the following Python script to observe the behavior of <Alt> in Windows Terminal (WT, for short)

s = input()
print(s.encode().hex())

When I pressed <Alt-x> (before press Enter), I got 1b78, meaning the WT transport byte code \0x1b\0x78 to the shell.

I'd like <Alt-x> works as \0x27\0x78 in WT. How should I config to achieve that?

Originally created by @ParadoxZW on GitHub (Apr 14, 2021). I've used the following Python script to observe the behavior of `<Alt>` in Windows Terminal (WT, for short) ```Python s = input() print(s.encode().hex()) ``` When I pressed `<Alt-x>` (before press Enter), I got 1b78, meaning the WT transport byte code `\0x1b\0x78` to the shell. I'd like `<Alt-x>` works as `\0x27\0x78` in WT. How should I config to achieve that?
claunia added the Issue-FeatureIssue-QuestionResolution-Duplicate labels 2026-01-31 03:42:14 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Apr 14, 2021):

Why \0x27\0x78? Isn't 0x27 the single quote character '?
image

I think there's another issue floating around for "Alt sends meta, not escape", but is there any terminal emulator out there that lets you configure alt to send an arbitrary character?

@zadjii-msft commented on GitHub (Apr 14, 2021): Why `\0x27\0x78`? Isn't `0x27` the single quote character `'`? ![image](https://user-images.githubusercontent.com/18356694/114699891-7a1c0580-9ce6-11eb-82a5-54c1ddf53e87.png) I think there's another issue floating around for "Alt sends meta, not escape", but is there any terminal emulator out there that lets you configure alt to send an _arbitrary_ character?
Author
Owner

@DHowett commented on GitHub (Apr 14, 2021):

On my machine, xterm seems to send \xc3\xb8 to the shell when in altIsNotMeta mode. This is true regardless of the setting of eightBitMeta. This is different from \x27\x78 as well.

@DHowett commented on GitHub (Apr 14, 2021): On my machine, xterm seems to send `\xc3\xb8` to the shell when in `altIsNotMeta` mode. This is true regardless of the setting of `eightBitMeta`. This is different from `\x27\x78` as well.
Author
Owner

@ParadoxZW commented on GitHub (Apr 15, 2021):

Why \0x27\0x78? Isn't 0x27 the single quote character '?
image

I think there's another issue floating around for "Alt sends meta, not escape", but is there any terminal emulator out there that lets you configure alt to send an arbitrary character?

<Alt-x> is \0x27\0x78, where \0x78 means key x.
In your machine, the WT sends meta for key <alt>? Why does it send escape in my case?

@ParadoxZW commented on GitHub (Apr 15, 2021): > Why `\0x27\0x78`? Isn't `0x27` the single quote character `'`? > ![image](https://user-images.githubusercontent.com/18356694/114699891-7a1c0580-9ce6-11eb-82a5-54c1ddf53e87.png) > > I think there's another issue floating around for "Alt sends meta, not escape", but is there any terminal emulator out there that lets you configure alt to send an _arbitrary_ character? `<Alt-x>` is `\0x27\0x78`, where `\0x78` means key `x`. In your machine, the WT sends meta for key `<alt>`? Why does it send escape in my case?
Author
Owner

@zadjii-msft commented on GitHub (Apr 15, 2021):

Wait no, sorry, that was a screenshot of asciitable.com.

On my machine, x, shift+x, ctrl+x, and alt+x emit the following:
image

which is the same as gnome-terminal:
image

I don't think any emulator would ever send \0x27 for alt

@zadjii-msft commented on GitHub (Apr 15, 2021): Wait no, sorry, that was a screenshot of asciitable.com. On my machine, <kbd>x</kbd>, <kbd>shift+x</kbd>, <kbd>ctrl+x</kbd>, and <kbd>alt+x</kbd> emit the following: ![image](https://user-images.githubusercontent.com/18356694/114860676-edd71480-9db1-11eb-9989-4108becb0354.png) which is the same as `gnome-terminal`: ![image](https://user-images.githubusercontent.com/18356694/114860814-14954b00-9db2-11eb-84c5-2dd5eccd64e5.png) I don't think _any_ emulator would ever send `\0x27` for <kbd>alt</kbd>
Author
Owner

@ghost commented on GitHub (Apr 19, 2021):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Apr 19, 2021): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Author
Owner

@ParadoxZW commented on GitHub (Apr 20, 2021):

On my machine, xterm seems to send \xc3\xb8 to the shell when in altIsNotMeta mode. This is true regardless of the setting of eightBitMeta. This is different from \x27\x78 as well.

I just want alt work as meta, rather than ^[. How should I config in the WT.

@ParadoxZW commented on GitHub (Apr 20, 2021): > On my machine, xterm seems to send `\xc3\xb8` to the shell when in `altIsNotMeta` mode. This is true regardless of the setting of `eightBitMeta`. This is different from `\x27\x78` as well. I just want alt work as meta, rather than `^[`. How should I config in the WT.
Author
Owner

@zadjii-msft commented on GitHub (Apr 20, 2021):

So, we don't currently have that setting. There's also a lot of discussion over in #6722 on this topic already. The summary:

Alright, I did a quick investigation of a few of our competitors.

It looks like gnome-terminal (vte) and konsole don't offer 8-bit meta mode any longer.

Given that it'll be really difficult to support and keep our core tenet of supporting more than just ASCII, and that the number of applications that are going to require it will trend towards zero with the inexorable march of time, I'm going to close this one out as, regrettably, Won't Fix

It also seems like it might be impossible for us to support. Windows applications generally receive UTF-16 or "native codepage" encoded input. Many of them, however, immediately convert that input to UTF-8. We can't encode an unjacketed character >= 0x80 (high bit set) in UTF-8 and expect it to come across as a high bit set in a 7-bit ASCII glyph through all of the cross-process communication channels that Windows requires.

Since WSL is just a Windows application, at the end of the day, it has to follow suit. We already have an issue where we can't send mouse coordinates using the legacy system >= 93 because they would require a high bit!

/dup #6722

@zadjii-msft commented on GitHub (Apr 20, 2021): So, we don't currently have that setting. There's also a lot of discussion over in #6722 on this topic already. The summary: > Alright, I did a quick investigation of a few of our competitors. > > It looks like gnome-terminal (vte) and konsole don't offer 8-bit meta mode any longer. > > Given that it'll be really difficult to support and keep our core tenet of supporting more than just ASCII, and that the number of applications that are going to require it will trend towards zero with the inexorable march of time, I'm going to close this one out as, regrettably, **Won't Fix** > > It also seems like it might be impossible for us to support. Windows applications generally receive UTF-16 or "native codepage" encoded input. Many of them, however, immediately convert that input to UTF-8. We can't encode an unjacketed character >= 0x80 (high bit set) in UTF-8 and expect it to come across as a high bit set in a 7-bit ASCII glyph through all of the cross-process communication channels that Windows requires. > > Since WSL is just a Windows application, at the end of the day, it has to follow suit. We already have an issue where we can't send mouse coordinates using the legacy system >= 93 because they would require a high bit! /dup #6722
Author
Owner

@ghost commented on GitHub (Apr 20, 2021):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (Apr 20, 2021): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#13422