Skip to content
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

Pasting into PowerShell running in Windows Terminal drops Unicode characters #8896

Closed
sba923 opened this issue Jan 26, 2021 · 5 comments
Closed
Labels
Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Product-Powershell Issues in the modern command interpreter, Powershell.exe. Resolution-External For issues that are outside this codebase

Comments

@sba923
Copy link

sba923 commented Jan 26, 2021

Environment

Windows build number: 10.0.18363.1256
Windows Terminal version (if applicable): 1.4.3243.0
PowerShell 7.1.1
Windows PowerShell 5.1
PSReadLine 2.2.0 beta1

Steps to reproduce

  1. Put the following string on the clipboard: C:\tmp\Captures d’écran where the is U+2019

(Verify as follows:

PS> $p=(Get-ClipboardText); for($i=0;$i -lt $p.Length; $i++) { '{0} {1:x4}' -f $p[$i], [int]($p[$i]) }
C 0043
: 003a
\ 005c
t 0074
m 006d
p 0070
\ 005c
C 0043
a 0061
p 0070
t 0074
u 0075
r 0072
e 0065
s 0073
  0020
d 0064
’ 2019
é 00e9
c 0063
r 0072
a 0061
n 006e

)

  1. Create a folder with this name e.g. using mkdir -Force (Get-ClipboardText) in PowerShell.
  2. In a PowerShell 7.1.1 or Windows PowerShell 5.1 session, type gci " followed by Ctrl+V followed by " followed by Enter.

Expected behavior

Whether PowerShell runs standalone or within Windows Terminal, this should work and show the contents of the C:\tmp\Captures d’écran folder.

Actual behavior

If PowerShell runs within Windows Terminal, the paste action drops the U+2019 character, resulting in an error:

PS> gci "C:\tmp\Captures décran"
Get-ChildItem: Cannot find path 'C:\tmp\Captures décran' because it does not exist.

The paste action works fine in a CMD prompt running within Windows Terminal.

Could that be the result of an interaction / incompatibility between PSReadLine and Windows Terminal?

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Jan 26, 2021
@KalleOlaviNiemitalo
Copy link

May be a duplicate of PowerShell/PSReadLine#1603. The workaround would be to remove the Ctrl+V key binding from settings.json of Windows Terminal so that WT passes the key combination to PowerShell, where PSReadLine then implements the paste feature correctly.

@sba923
Copy link
Author

sba923 commented Jan 26, 2021

I confirm removing the Ctrl+V binding from settings.json and then using Ctrl+V to paste causes the pasting to be correct.

But won't this affect other (non-PowerShell/PSReadLine) scenarios?

And this doesn't "fix" pasting with Shift+Ins or right mouse-click.

@KalleOlaviNiemitalo
Copy link

But won't this affect other (non-PowerShell/PSReadLine) scenarios?

Yes, it will. You can then use Ctrl+V to paste to PSReadLine, and Shift+Insert or Ctrl+Shift+V to paste to other software.

I guess another workaround would be to uninstall PSReadLine until PowerShell/PSReadLine#1603 is fixed.

@zadjii-msft
Copy link
Member

(I'm gonna resolve this as a dup of the upstream issue, but feel free to continue the conversation. Thanks!)

@zadjii-msft zadjii-msft added Resolution-External For issues that are outside this codebase Product-Powershell Issues in the modern command interpreter, Powershell.exe. labels Jan 26, 2021
@sba923
Copy link
Author

sba923 commented Jan 26, 2021

But won't this affect other (non-PowerShell/PSReadLine) scenarios?

Yes, it will. You can then use Ctrl+V to paste to PSReadLine, and Shift+Insert or Ctrl+Shift+V to paste to other software.

I guess another workaround would be to uninstall PSReadLine until PowerShell/PSReadLine#1603 is fixed.

Unininstalling PSReadLine? That would be cutting my right arm! 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Product-Powershell Issues in the modern command interpreter, Powershell.exe. Resolution-External For issues that are outside this codebase
Projects
None yet
Development

No branches or pull requests

3 participants