Garbled characters appear in the return values of the command-line tool

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Garbled characters appear in the return values of the command-line tool

Steps to Reproduce

in Agent chat panel, the agent may run some command , such as Node.js,poweshell…
the command response include some garbled characters.

It cause me can’t relize what happend.

Operating System

Windows 10/11

Version Information

Version: 3.1.15 (system setup)
VSCode Version: 1.105.1
Commit: 3a67af7b780e0bfc8d32aefa96b8ff1cb8817f80
Date: 2026-04-15T01:46:06.515Z
Layout: editor
Build Type: Stable
Release Track: Nightly
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.26200

For AI issues: which model did you use?

gpt 5.4 mini

Additional Information

My windows OS computer use Chinese language.

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, this is a known bug on Chinese Windows. The agent shell decodes command output as UTF-8, but the system code page is GBK 936, so you get mojibake.

It also happens in other agent tools like Write and StrReplace. Related threads:

As a workaround, you can try:

  1. Add a rule in .cursor/rules or the system prompt so the agent sets UTF-8 at the start of PowerShell commands:
    chcp 65001 > $null
    [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
    $OutputEncoding = [System.Text.Encoding]::UTF8
    
  2. For Node.js scripts, run with set NODE_OPTIONS=--stdout-encoding=utf8, or write output to a file and read it from there.
  3. System option: Settings > Time & Language > Language & region > Administrative language settings > Beta: Use Unicode UTF-8 for worldwide language support. Reports in the other thread say it sometimes doesn’t help, but it’s worth trying.

I’ll post here once there’s an update on the fix.