Skip to content

[Bug] exec tool output encoding issue on Windows - Chinese characters display as garbled text #30640

@jiangzhw

Description

@jiangzhw

Summary

Bug Description

The exec tool's output displays Chinese characters as garbled text (e.g., ���ԡ���) when executing PowerShell commands on Windows, even though the actual file operations work correctly.

Environment

  • OS: Windows_NT 10.0.26200 (x64)
  • Node.js: v24.14.0
  • OpenClaw Version: 2026.2.26
  • Shell: PowerShell
  • System Code Page: 936 (GBK/GB2312)
  • OpenClaw Default Shell: powershell

Steps to reproduce

Steps to Reproduce

  1. Create a folder with Chinese characters and special symbols:
    mkdir "D:\openClaw\WP-MISC\测试~;"

Use OpenClaw exec tool to list directory:
Observe the output - folder name displays as ���ԡ��� instead of 测试~;

Expected behavior

Chinese characters should display correctly in exec tool output, matching PowerShell's actual behavior.

Actual behavior

Output shows garbled text: ���ԡ���

OpenClaw version

2026.2.26

Operating system

windows10

Install method

npm

Logs, screenshots, and evidence

Impact and severity

The issue appears to be in the encoding conversion chain between:
PowerShell output (GBK 936 or UTF-8)
Node.js child_process capture
OpenClaw exec tool result display

Additional information

Windows Explorer: ✅ Displays correctly as 测试~;
PowerShell direct execution: ✅ Displays correctly
OpenClaw file tools (write/read): ✅ Work correctly with UTF-8
Only exec tool output: ❌ Shows encoding issues

The issue appears to be in the encoding conversion chain between:
PowerShell output (GBK 936 or UTF-8)
Node.js child_process capture
OpenClaw exec tool result display

Suggested Fix
Consider adding encoding detection or configuration option for exec tool, similar to:
{
"exec": {
"encoding": "utf8" // or "auto" to detect system code page
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions