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

Closed
opened 2026-01-31 03:08:59 +00:00 by claunia · 5 comments
Owner

Originally created by @sba923 on GitHub (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?

Originally created by @sba923 on GitHub (Jan 26, 2021). # Environment ```none 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 ```` ) 2. Create a folder with this name e.g. using `mkdir -Force (Get-ClipboardText)` in PowerShell. 3. 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?
claunia added the Needs-TriageResolution-ExternalNeeds-Tag-FixProduct-Powershell labels 2026-01-31 03:08:59 +00:00
Author
Owner

@KalleOlaviNiemitalo commented on GitHub (Jan 26, 2021):

May be a duplicate of https://github.com/PowerShell/PSReadLine/issues/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.

@KalleOlaviNiemitalo commented on GitHub (Jan 26, 2021): May be a duplicate of <https://github.com/PowerShell/PSReadLine/issues/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.
Author
Owner

@sba923 commented on GitHub (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.

@sba923 commented on GitHub (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.
Author
Owner

@KalleOlaviNiemitalo commented on GitHub (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 https://github.com/PowerShell/PSReadLine/issues/1603 is fixed.

@KalleOlaviNiemitalo commented on GitHub (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 <https://github.com/PowerShell/PSReadLine/issues/1603> is fixed.
Author
Owner

@zadjii-msft commented on GitHub (Jan 26, 2021):

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

@zadjii-msft commented on GitHub (Jan 26, 2021): (I'm gonna resolve this as a dup of the upstream issue, but feel free to continue the conversation. Thanks!)
Author
Owner

@sba923 commented on GitHub (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! 😆

@sba923 commented on GitHub (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](https://github.com/PowerShell/PSReadLine/issues/1603) is fixed. Unininstalling PSReadLine? That would be cutting my right arm! 😆
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#12205