-
Notifications
You must be signed in to change notification settings - Fork 854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clipboard corruption with clip.exe #4852
Comments
Took a bit to figure out what "fail" meant. You are pasting after the clip. Okay. Confirmed here. Don't know whether it is the same as #3716, which celebrated a birthday last month. Probably. |
One liner that is a little more succinct:
The only real difference vs. #3716 is that over there we were working with the thesis a single character was the culprit. Appears the contents of the string (not the length) triggers.
These results are independently reproducible, not rando buffer corruption. Now for the (very bad for us) news. I am pretty convinced the culprit is Winclip meanwhile is consistently correct. Bad because, if this hypothesis is correct, the issue dies dreaded tag external. |
Thanks for simplifying the test case and further investigation. For some bizzare reason in regular CMD
works as expected, ignoring appended \r\n Regarding Winclip this seeps like the way to go. Is there any way to get hold of compiled version of it? |
You're imagining semantic equivalencies because the strings [Not that the CRLF is the point. It isn't. The two scenarios are semantically different with or without the CRLF.] That said, I (double negative) can't prove there isn't a way for WSL interop to make Windows
I got it from here. No endorsement; I don't use it, I just found it in a quick google search yesterday. There are other third-party |
Thank you very much After more fiddling I got what I wanted (including discarding newline)
But as you mentioned with clip.exe
So it seems it is somehow dependent on the length. Or the passed value is interpreted as some sort of encoding? |
Been using this tool for a bit and so far so good. Install in Windows side:
then in wsl side: |
utf8clip works, and I thank @bluemarsh for providing it, but it's absolutely ridiculous that it's needed. Absolutely ridiculous. Just add a /UTF8 flag. Or respect locale. Or something. Anything but what you're doing. What encoding is even default? 🤦 |
If Edit: |
Suddenly it start happening for me few weeks ago... I wonder if there is a working solution? Works great! Thanks @Gorthog for suggestion. |
This also reproduces similarly with With WSLg, this is slightly better in that I noticed with emoji, not any particular string (but was also able to reproduce with just wsl-debian$ clip.exe <<<'🌸'; xclip -selection clipboard -out; echo
≡ƒî╕ What's interesting IMO is that running the same from Git Bash on my host yields a different result, so unless I've horribly misunderstood, it seems like it's WSL related somehow, but I can't figure out exactly how: git-bash$ clip.exe <<<'🌸'; debian run xclip -selection clipboard -out; echo
🌸 More fun examples, to show it's clipboard-specific: wsl-debian$ /mnt/c/Program\ Files/Git/usr/bin/cat.exe <<<'🌸'
🌸
wsl-debian$ powershell.exe '$Input' <<<'🌸'
🌸
wsl-debian$ powershell.exe '$Input | Set-Clipboard' <<<'🌸'; xclip -selection clipboard -out; echo
≡ƒî╕ Edit: very interestingly, it seems that the clipboard functionality in NeoVim is unaffected (even over SSH), so I guess I just need to stop using Edit 2: winning ticket: $ ssh wsl 'DISPLAY=:0 nvim -Es +%\!xclip\ -out\ -selection\ clipboard\ -in' <<<'🙈'
$ ssh wsl DISPLAY=:0 xclip -selection clipboard -out
🙈 (no idea why |
I was able to circumvent this issue by appending a null character at the end. # Bug: clipboard returns 'ㄵ㥢㤶㙥㐭ㅡⴰ㝥〰㔭㑣ⵦ㜹㌸づ㕢ぢぢ'
echo -n 51b969e6-4a10-e700-5c4f-9783e0b5b0b0 | clip.exe
# Fix: clipboard returns '51b969e6-4a10-e700-5c4f-9783e0b5b0b0'
printf "51b969e6-4a10-e700-5c4f-9783e0b5b0b0\x00" | clip.exe |
#11047 There was a solution here, setting |
i found a solution via iconv
|
ver
Microsoft Windows [Version 10.0.18363.592]
WSL distro
Attempting to copy string into clipboard using clip.exe.
For certain text (possibly depends on the length) clipboard seems to have corrupt data
Examples of the correct and corrupt clipboard (pasted content of the clipboard is on the second line, after the command)
This one fails
With "x" in front of it, it works OK
In command line window it looks like:
![image](https://user-images.githubusercontent.com/778457/73266450-d0c71d80-41ce-11ea-8be2-6b82b76e792a.png)
Expecting text to be copied to clipboard regardless of the text length
Possibly related to:
#3716
Update:
Added explanation of the second line on the command line (based on comment from @therealkenc)
The text was updated successfully, but these errors were encountered: