fix(tui): preserve utf8 when copying via powershell#35122
Closed
BROCCOLO1D wants to merge 1 commit into
Closed
Conversation
Collaborator
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/copyon WSL/Windows when text is written through PowerShell.Why
WSL sends
/copytext topowershell.exe Set-Clipboardover stdin. On systems with non-UTF-8 ANSI code pages, PowerShell can decode those UTF-8 bytes as the local code page before writing the Windows clipboard, which garbles CJK and other non-ASCII text.Changes
$inputPowerShell write path with[Console]::In.ReadToEnd()after setting[Console]::InputEncodingto UTF-8.Validation
cd ui-tui && npx eslint src/lib/clipboard.ts src/__tests__/clipboard.test.tscd ui-tui && npm test -- --run src/__tests__/clipboard.test.tsScope
Focused on TUI clipboard writes through PowerShell. Clipboard reads and non-PowerShell Linux/macOS backends are unchanged.
Closes #35107