qinghuidaqzp/dsh-encoding-guard ↗★ 0
dsh-encoding-guard
Keeps file encodings intact in DeepSeek Harness: read and edit GBK/GB18030, Big5, Shift_JIS, EUC-KR and UTF-16 files in their own encoding, restore the UTF-8 BOM and CRLF line endings the built-in edit/write/apply_patch tools drop, and refuse writes that introduce mojibake.
安裝
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add dsh-encoding-guard說明文件
閱讀完整 README ↗配置
在 profile 的 cordis.patch.yml($DSH_HOME/profiles//cordis.patch.yml)里覆盖。patch 会整体替换 config,没写的键回到下表的默认值:
- id: encoding-guard
config:
candidates: [big5, gbk, shift_jis, euc-kr] # 繁体项目把 big5 放前面
mojibakeGuard: ask # deny | ask | off
| 键 | 默认值 | 说明 |
|---|---|---|
candidates | [gbk, big5, shift_jis, euc-kr] | 文件不是 UTF-8 时依次尝试的编码,按常用字频率打分选最可信的 |
registerTools | true | 是否注册 3 个 encoded_* 工具 |
hintOnUtf8Failure | true | 官方文件工具报非 UTF-8 错误时追加编码提示 |
shellHint | true | shell 输出含 � 时提示(每会话一次) |
shellToolNames | [bash] | 检查 � 的工具名 |
preserveBom | true | 补回被删掉的 UTF-8 BOM |
preserveCrlfOnWrite | true | write 覆盖 CRLF 文件时保持 CRLF |
mojibakeGuard | deny | 新引入乱码时:deny 拒绝,ask 走审批,off 关闭 |
restrictWritesToWorkspace | true | encoded_edit / encoded_write 只改会话工作目录内的文件 |
maxFileBytes | 8388608 | 读取 / 改写的最大文件大小 |
readLineLimit | 2000 | encoded_read 默认返回行数 |