encoding-fixer
NewAuto-detect and fix missing encoding=utf-8 in AI tool skill Python scripts. Works with Claude Code, Codex CLI, ClawdHub, Trae, Amp, Antigravity, Cline and any npx skills-compatible tool. Triggers: install skill, new skill, encoding error, GBK, chcp, 编码错误, 安装技能, 新建skill.
Overview
Encoding Fixer
IRON LAW: Every write_text() and text-mode open() in skill scripts MUST have encoding="utf-8". On Chinese Windows, Python defaults to GBK — emoji and Unicode characters crash. Fix immediately, don't wait for the error.
When to Run
- •After installing ANY new skill via
npx skills addor manual download - •When user reports encoding errors (
GBK codec,UnicodeEncodeError,chcp) - •Proactively after
find-skillsinstalls something
Workflow
Step 1: Run Auto-Fix
python3 .claude/skills/encoding-fixer/scripts/encoding-fix.pyThis does two things automatically:
- Scans ALL
.pyfiles under.claude/skills/ - Adds
encoding="utf-8"to everywrite_text()and text-modeopen()that's missing it - Skips binary mode (
"rb","wb") — those don't need encoding - Skips
webbrowser.open()— not a file operation
Step 2: Read the Report
The script outputs a two-part report:
`[FIXED]` — files that were auto-patched. These are done, no further action needed.
`[REVIEW]` — potential issues the auto-fixer couldn't handle. These are usually:
- •False positive (most common): multi-line calls like
write_text(\n generate_html(...)\n)— the regex can't match across lines, but the call already hasencoding="utf-8". Read the file at that line to verify. - •Real miss (rare): the call genuinely lacks encoding, e.g. nested in a complex expression. Fix manually with Edit.
Step 3: Handle REVIEW Items
For each REVIEW item:
- Read the file at the reported line
- Check: does the call already have
encoding="utf-8"?
- YES → mark as false positive, skip - NO → manually add , encoding="utf-8" to the call
Step 4: Verify Clean
After all fixes, re-run with --check-only to confirm zero issues:
python3 .claude/skills/encoding-fixer/scripts/encoding-fix.py --check-onlyNo output = all clean.
Anti-Patterns
- •NO: Installing a skill and forgetting to run the fixer
- •NO: Waiting for a GBK crash before fixing
- •NO: Assuming English Windows users don't need it — UTF-8 is correct everywhere
- •NO: Adding encoding to binary-mode
open("rb")/open("wb")calls
Pre-Delivery Checklist
After fixing:
- •[ ] Auto-fix script ran successfully
- •[ ] All REVIEW items manually verified (false positive or fixed)
- •[ ]
--check-onlyreturns no issues
Install & Usage
mkdir -p .claude/skillsmkdir -p .claude/skills && curl -o .claude/skills/encoding-fixer.md https://raw.githubusercontent.com/WANSIKQI/skill-encoding-fixer/main/SKILL.md/encoding-fixerFrequently Asked Questions
What is encoding-fixer?
Auto-detect and fix missing encoding=utf-8 in AI tool skill Python scripts. Works with Claude Code, Codex CLI, ClawdHub, Trae, Amp, Antigravity, Cline and any npx skills-compatible tool. Triggers: install skill, new skill, encoding error, GBK, chcp, 编码错误, 安装技能, 新建skill.
How to install encoding-fixer?
To install encoding-fixer, create the .claude/skills directory in your project, then run the curl command to download the skill file. Once installed, invoke it in Claude Code with /encoding-fixer.
What is encoding-fixer best for?
encoding-fixer is a community categorized under General. It is designed for: python. Created by WANSIKQI.