Skip to content

Strange characters at the beginning of file when creating or opening (when SSH'd from WSL to Windows 10) #414

Closed as duplicate

Description

@robertstrom

I have downloaded edit.exe and have run it locally in a PowerShell v7 shell and also have it copied to a remote Windows 10 machine. The executable has been copied to the C:\Windows\System32 directory on both systems.

When I run edit.exe locally it seems to behave properly.

This is what it looks like when I run edit.exe using this command

edit.exe testing_edit.exe_123.txt 

Image

This is what it looks like on the remote Windows 10 system when I run edit.exe using this command (SSH'd into from an Ubuntu WSL shell). I tested SSH'ing into the system from a PowerShell v5 shell and launching edit and saw the same behavior. The remote Windows 10 machine is configured to use PowerShell v7 for it's default shell when you connect via SSH. PowerShell v 7 is PowerShell 7.5.1

edit testing1234.txt

Image

Now I blank out that text and type this text and save the file

Image

Image

Now I reopen the file edit testing1234.txt and there are all kinds of strange characters inserted into the file. This happens each and every time the file is created or opened.

Image

Activity

  1. robertstrom commented on Jun 3, 2025

    @robertstrom
    Author

    This is just typing edit on that remote Windows 10 system

    Image

  2. robertstrom commented on Jun 3, 2025

    @robertstrom
    Author

    Mouse does not work on the remote system. Not sure if it is supposed to or not (probably not).

  3. zcobol commented on Jun 4, 2025

    @zcobol

    This has been reported in #243 and #377 also. All reported cases involve SSHing into remote server. I can replicate it using RDP to a Server 2025 running a Core 2022 Docker container with no SSH involved, just run docker container attach <container-name>:

    Image

  4. zcobol commented on Jun 4, 2025

    @zcobol

    Here is some debug output when launching edit.exe resulting in c0c on the first line:

    ␛]0;Administrator:␣c:\windows\system32\cmd.exe␣-␣edit.exe␇␛[?1002;1006;2004h␛[?1036h␛]4;0;?;1;?;2;?;3;?;4;?;5;?;6;?;7;?␇␛]4;8;?;9;?;10;?;11;?;12;?;13;?;14;?;15;?␇␛]10;?␇␛]11;?␇␛]4;0;rgb:0c0c/0c0c/0c0c␛\␛]4;1;rgb:c5c5/0f0f/1f1f␛\␛]4;2;rgb:1313/a1a1/0e0e␛\␛]4;3;rgb:c1c1/9c9c/0000␛\␛]4;4;rgb:0000/3737/dada␛\␛]4;5;rgb:8888/1717/9898␛\␛]4;6;rgb:3a3a/9696/dddd␛\␛]4;7;rgb:cccc/cccc/cccc␛\␛]4;8;rgb:7676/7676/7676␛\␛]4;9;rgb:e7e7/4848/5656␛\␛]4;10;rgb:1616/c6c6/0c0c␛\␛]4;11;rgb:f9f9/f1f1/a5a5␛\␛]4;12;rgb:3b3b/7878/ffff␛\␛]4;13;rgb:b4b4/0000/9e9e␛\␛]4;14;rgb:6161/d6d6/d6d6␛\␛]4;15;rgb:f2f2/f2f2/f2f2␛\␛]10;rgb:cccc/cccc/cccc␛\␛]11;rgb:0c0c/0c0c/0c0c␛\␛[?25l␛[H␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␍␊
    ␛[K␛[H␛[?25h␛[5␣q␛[5␣q␛[38;2;190;190;190m␛[48;2;23;52;127m␣␛[4mF␛[24mile␣␣␛[4mE␛[24mdit␣␣␛[4mV␛[24miew␣␣␛[4mH␛[24melp␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␛[38;2;211;211;211m␛[48;2;40;40;40m1␣│␣␛[38;2;255;255;255mc0c␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␛[48;2;0;0;0m␣␛[38;2;211;211;211m␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␛[38;2;190;190;190m␛[48;2;23;52;127m␣[CRLF]␣␣[UTF-8]␣␣[Spaces:4]␣␣1:4␣␣*␣␣␣␣␣[Untitled-1.txt]␣␛[2;8H␛]0;Untitled-1.txt␣-␣edit␇␛[13;28;13;0;0;1_␛[O
    

    and when pressing Ctrl+W and move focus to Don't Save:

    ␛[17;29;0;1;8;1_␛[87;17;23;1;8;1_␛[?25l␛[38;2;72;72;72m␛[48;2;3;13;45m␛[H␣␛[4mF␛[24mile␣␣␛[4mE␛[24mdit␣␣␛[4mV␛[24miew␣␣␛[4mH␛[24melp␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␛[38;2;81;81;81m␛[48;2;0;0;0m1␣│␣␛[38;2;99;99;99mc0c␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␛[38;2;81;81;81m␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␛[38;2;255;255;255m␛[48;2;190;44;33m┌─␣Unsaved␣Changes␣───────────────────────────┐␛[38;2;99;99;99m␛[48;2;0;0;0m␣␣␣␣␣␣␛[38;2;81;81;81m␣␣│␣␣␛[38;2;255;255;255m␛[48;2;190;44;33m│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣│␛[38;2;99;99;99m␛[48;2;0;0;0m␣␣␣␣␣␣␛[38;2;81;81;81m␣␣│␣␣␛[38;2;255;255;255m␛[48;2;190;44;33m│␣␣Do␣you␣want␣to␣save␣the␣changes␣you␣made?␣␣│␛[38;2;99;99;99m␛[48;2;0;0;0m␣␣␣␣␣␣␛[38;2;81;81;81m␣␣│␣␣␛[38;2;255;255;255m␛[48;2;190;44;33m│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣│␛[38;2;99;99;99m␛[48;2;0;0;0m␣␣␣␣␣␣␛[38;2;81;81;81m␣␣│␣␣␛[38;2;255;255;255m␛[48;2;190;44;33m│␣␣␣␣␣␣␣␛[38;2;190;44;33m␛[48;2;255;255;255m[␛[4mS␛[24mave]␛[38;2;255;255;255m␛[48;2;190;44;33m␣␣[Do␛[4mn␛[24m't␣Save]␣␣[Cancel]␣␣␣␣␣␣␣␣│␛[38;2;99;99;99m␛[48;2;0;0;0m␣␣␣␣␣␣␛[38;2;81;81;81m␣␣│␣␣␛[38;2;255;255;255m␛[48;2;190;44;33m│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣│␛[38;2;99;99;99m␛[48;2;0;0;0m␣␣␣␣␣␣␛[38;2;81;81;81m␣␣│␣␣␛[38;2;255;255;255m␛[48;2;190;44;33m└─────────────────────────────────────────────┘␛[38;2;99;99;99m␛[48;2;0;0;0m␣␣␣␣␣␣␛[38;2;81;81;81m␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␣␣│␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␛[K␛[38;2;72;72;72m␛[48;2;3;13;45m␣[CRLF]␣␣[UTF-8]␣␣[Spaces:4]␣␣1:4␣␣*␣␣␣␣␣[Untitled-1.txt]␣␛[87;17;23;0;8;1_␛[17;29;0;0;0;1_␛[39;77;0;1;256;1_␛[38;2;99;99;99m␛[48;2;0;0;0m␛[38;2;81;81;81m␛[16;1H␣␣│␣␣␛[38;2;255;255;255m␛[48;2;190;44;33m│␣␣␣␣␣␣␣[␛[4mS␛[24mave]␣␣␛[38;2;190;44;33m␛[48;2;255;255;255m[Do␛[4mn␛[24m't␣Save]␛[38;2;255;255;255m␛[48;2;190;44;33m␣␣[Cancel]␣␣␣␣␣␣␣␣│␛[38;2;99;99;99m␛[48;2;0;0;0m␣␣␣␣␣␣␛[39;77;0;0;256;1_␛[O
    
  5. lhecker commented on Jun 4, 2025

    @lhecker
    Member

    I'm going to close both this issue and #377 in favor of #243 so we can focus the discussion in a single place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions