OSC 52 clipboard write stores raw UTF-8 bytes, causing CJK characters when pasted on Windows/WSL
- Langage dominant
- Shell
- Étoiles
- 11.2k
- Forks
- 1.9k
- Merge moyen
- 14 h 16 min
- PR mergées (30 j)
- 6
Description
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
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par le chemin d’écriture du presse-papiers OSC 52 utilisé lorsque Copilot CLI affiche les réponses, puis reproduisez le problème dans WSL via Windows Terminal avec une commande de plus de 30 caractères. Suivez la façon dont le texte sélectionné est encodé et vérifiez que le collage préserve la commande complète et ses caractères sous Windows, y compris la commande de reproduction fournie.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- shell, ubuntu
- Domaine
- cli, operating-systems
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Calme
- Clarté
- Plutôt claire
- Accessibilité débutants
- 48/100