Loading...
Loading...
Compare original and translation side by side
JSON.stringify()\uD8xxJSON.stringify()\uD8xxgrep -rl "req_XXXXX" ~/.claude/projects/*/grep -rl "req_XXXXX" ~/.claude/projects/*/undefinedundefined
The script:
1. Reads each file with `errors='surrogateescape'` to preserve bad characters for detection
2. Parses JSON and recursively checks all string values for surrogate code points
3. Replaces lone surrogates with U+FFFD (replacement character) via `str.encode('utf-8', 'surrogatepass').decode('utf-8', 'replace')`
4. Backs up originals as `.bak` before modifying
5. Reports a summary of what was found and fixed
脚本执行逻辑:
1. 使用`errors='surrogateescape'`读取每个文件,保留异常字符用于检测
2. 解析JSON并递归检查所有字符串值中是否存在代理字符编码点
3. 通过`str.encode('utf-8', 'surrogatepass').decode('utf-8', 'replace')`将孤立代理字符替换为U+FFFD(替换字符)
4. 修改前将原文件备份为`.bak`格式
5. 输出检测和修复结果的汇总报告python {SKILL_DIR}/scripts/fix_surrogates.py ~/.claude/ --recursive --dry-runpython {SKILL_DIR}/scripts/fix_surrogates.py ~/.claude/ --recursive --dry-run{SKILL_DIR}{SKILL_DIR}{SKILL_DIR}{SKILL_DIR}