OSC 52 clipboard write stores raw UTF-8 bytes, causing CJK characters when pasted on Windows/WSL
- 主要语言
- Shell
- 星标
- 11.2k
- 派生
- 1.9k
- 平均合并
- 14 小时 16 分钟
- 30 天内合并 PR
- 6
描述
Copilot CLI writes shell commands to the clipboard via OSC 52 when rendering responses. On Windows Terminal + WSL, the OSC 52 content is stored as raw UTF-8 bytes rather than UTF-16LE. When pasting, Windows interprets the bytes as UTF-16LE, producing CJK characters.
Steps to reproduce:
1. Run Copilot CLI in WSL via Windows Terminal
2. Ask for a command (e.g. sudo apt install libsecret-tools gnome-keyring)
3. Select 30+ characters from the command and Ctrl+C
4. Paste anywhere
Expected: sudo apt install libsecret-tools gnome-keyring
Actual: 畳潤愠瑰椠獮慴汬氠扩敳牣瑥琭潯獬朠潮敭欭祥楲杮
Evidence:
- [System.Windows.Forms.Clipboard]::GetText() always returns the full 46-byte command as 23 UTF-16LE code points, regardless of actual selection length
- No hidden/control characters present — pure ASCII bytes misread as UTF-16LE pairs
- Selecting fewer than 30 characters works correctly (selection stays within OSC 52 boundary)
- Copying the same string from Notepad works correctly
Environment:
- Windows 11, Windows Terminal (latest), WSL Ubuntu
- $LANG=C.UTF-8, system locale: German (Germany)
Workaround: Use /copy slash command instead of manual selection
贡献指南
调研方向
Start at the OSC 52 clipboard write path used when Copilot CLI renders responses, then reproduce the issue in WSL through Windows Terminal with a command longer than 30 characters. Trace how the selected text is encoded and verify that pasting preserves the complete command and its characters on Windows, including the provided reproduction command.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- shell, ubuntu
- 领域
- cli, operating-systems
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100