-
Notifications
You must be signed in to change notification settings - Fork 3.5k
pi-coding-agent /copy command garbles Chinese characters on Windows #2347
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
When using the built-in /copy command to copy text containing Chinese characters to the clipboard on Windows, the pasted content shows garbled/corrupted characters instead of the original Chinese text.
Environment:
- OS: Windows 11
- pi version: 0.60.0
- Terminal: Windows Terminal
Steps to Reproduce:
- Start pi in interactive mode
- Have the assistant respond with Chinese text (e.g., "你好,世界")
- Run
/copyto copy the last assistant message - Paste into any application (Notepad, browser, etc.)
Expected Behavior:
The Chinese characters should be copied correctly and paste as "你好,世界"
Actual Behavior:
The pasted text shows garbled characters (mojibake)
Root Cause Analysis:
The issue appears to be in the @mariozechner/clipboard native module (NAPI-RS/Rust based). On Windows, the clipboard API requires UTF-16 encoding, but the module may not be correctly converting UTF-8 input to UTF-16 before writing to the clipboard.
Workaround:
Using PowerShell as an alternative works correctly:
!powershell -Command "Set-Clipboard -Value 'Chinese text here'"
### Steps to reproduce
pi console output: 你好,世界
/copy
sublime text view: 浣犲ソ锛屼笘鐣
### Expected behavior
_No response_
### Version
_No response_
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working