Weird control characters when pasting from windows clipboard to WSL2 #22924

Open
opened 2026-01-31 08:27:25 +00:00 by claunia · 0 comments
Owner

Originally created by @0anton on GitHub (Feb 15, 2025).

Windows Terminal version

1.23.10353.0

Windows build number

10.0.19045.0

Other Software

cat, vim 9.0 (inside WSL2)

Steps to reproduce

Since recent time I encounter weird control character pasted before my actuall text, when I try to paste by clipboard into WSL terminal. It is reproduceable in vim and with simple cut:

Notice this unexpected characters ^[ at the beginning of the string:

 $ cat > test-file.json
^[{
  "pubsub_msg": "\"{\\\"kind\\\": \\\"storage#object\\\", \\\"id\\\":

cat > test-file.json

Right-mouse paste works fine, no extra characted is inserted:

[{
  "pubsub_msg[{
": "\"{\\\"kind\\\": \\\"storage#object\\\", 

The behavior is both reproduceable with Ctrl-V and with Ctrl-Shift-V.

I tried to follow the advice of https://github.com/microsoft/terminal/issues/10572 and put into .inputrc lines:

set enable-bracketed-paste off

but it does not help...

The problem only appears in Windows Terminal, but not in wsl.exe for example.

The problem does not affect other shells, like PowerShell or CMD.EXE.

Interestingly, if the content is not formatted like hello world, it is being pasted withtout weird control character:

$ cat > /dev/null

hello world

Does anybody knows what is this problem?
It is very annoying to manually remove this characters from vim buffers manually after every paste...

Originally created by @0anton on GitHub (Feb 15, 2025). ### Windows Terminal version 1.23.10353.0 ### Windows build number 10.0.19045.0 ### Other Software cat, vim 9.0 (inside WSL2) ### Steps to reproduce Since recent time I encounter weird control character pasted before my actuall text, when I try to paste by clipboard into WSL terminal. It is reproduceable in `vim` and with simple `cut`: Notice this unexpected characters `^[` at the beginning of the string: ``` $ cat > test-file.json ^[{ "pubsub_msg": "\"{\\\"kind\\\": \\\"storage#object\\\", \\\"id\\\": ``` cat > test-file.json Right-mouse paste works fine, no extra characted is inserted: ``` [{ "pubsub_msg[{ ": "\"{\\\"kind\\\": \\\"storage#object\\\", ``` The behavior is both reproduceable with _Ctrl-V_ and with _Ctrl-Shift-V_. I tried to follow the advice of https://github.com/microsoft/terminal/issues/10572 and put into `.inputrc` lines: ``` set enable-bracketed-paste off ``` but it does not help... The problem only appears in Windows Terminal, but not in `wsl.exe` for example. The problem does not affect other shells, like PowerShell or CMD.EXE. Interestingly, if the content is not formatted like `hello world`, it is being pasted withtout weird control character: ``` $ cat > /dev/null hello world ``` Does anybody knows what is this problem? It is very annoying to manually remove this characters from vim buffers manually after every paste...
claunia added the Issue-BugArea-InputNeeds-Tag-FixProduct-Terminal labels 2026-01-31 08:27:25 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22924