Agent skill · software engineering · aiskillstore

charset-fix

Fix Chinese/Unicode character encoding issues when running AI agents on Windows via POSIX shells (Git Bash, MSYS2, WSL, BusyBox, etc.). Handles Python, PowerShell, and cmd.exe GBK/CP936 output encoding mismatch with UTF-8 terminals.

Why this skill is useful

Adds executable scripts and commands to handle character encoding issues specific to Windows environments that the AI wouldn't generate on its own.

What it needs

Requires python3 installed locally. About 2k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.

What this skill does

Windows Character Encoding Fix for AI Agents Fix garbled Chinese/Unicode text output when running AI agents on Windows through POSIX-compatible shells. Problem When AI agents run commands on Windows through POSIX shells (Git Bash, MSYS2, BusyBox, or any Unix-like shell layer), text output containing Chinese or extended Unicode characters often appears garbled: Root Cause Layer Encoding Why ------- ---------- ----- Windows system GBK/GB2312 (CP936) Default code page for Chinese Windows Python 3 GBK sys.stdout.encoding auto-detects system code page PowerShell (powershell.exe) GB2312 [Console]::OutputEncoding defaults to system CP cmd.exe GBK Native Windows command processor POSIX shell (Git Bash, BusyBox, MSYS2) UTF-8 Expects UTF-8 input PowerShell Core (pwsh.exe) UTF-8 ✅ Defaults to UTF-8, no fix needed The mismatch: Windows-native tools output GBK-encoded text, but the POSIX shell terminal reads it as UTF-8, producing garbled characters. Quick Fix Python Set it for the whole session: PowerShell (Windows PowerShell, not Core) cmd.exe / Windows native tools Use Python's subprocess as a GBK→UTF-8 bridge: Code-level fix (Python) Verification Expected: charset-fix: 中文测试成功 ✅ How It Works Fix Mechanism ----- ----------- PYTHONIOENCODING=utf-8 Overrides Python's stdout encoding detection [Console]::OutputEncoding = UTF8 Sets PowerShell's console output to UTF-8 subprocess(..., encoding='gbk') Decodes cmd.exe output correctly, then emits as UTF-8 Compatibility Platform Status ---------- -------- Windows + Git Bash ✅ Works Windows + BusyBox ✅ Works Windows + MSYS2 ✅ Works Windows + WSL ✅ Works macOS / Linux ⬜ Not needed PowerShell Core (pwsh) ⬜ Not needed Works with: Claude Code, Codex CLI, Cline, Cursor, GitHub Copilot, OpenClaw agents. Debugging License MIT

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills aiskillstore/charset-fix

View the source on GitHub

Browse the @skills marketplace