Hey, thanks for the detailed report with repro steps and the workaround. This is a known bug. On Windows, the agent Write and StrReplace tools save files in the wrong encoding, UTF-16 LE or the system code page, instead of UTF-8. Then gh pr create --body-file reads them as UTF-8, which breaks Unicode punctuation. The issue is reported internally, but I can’t share a fix timeline yet.
Your workaround is solid. Until this is fixed, the best option is either to keep PR and commit bodies in ASCII, use - instead of -- and to instead of ->, or force UTF-8 through the whole pipeline, run chcp 65001 plus [Console]::OutputEncoding = [System.Text.UTF8Encoding]::new() before gh.
These threads describe the same issue if you want to follow along:
- Spending tokens to repair UTF-16 that should have been UTF-8
- Windows — Agent tools (Write / StrReplace) save files as UTF-16 LE instead of UTF-8
I’ll reply once there’s an update on the fix.