dsh-encoding-guard

Reads and edits GBK/GB18030, Big5, Shift_JIS, EUC-KR and UTF-16 files in their own encoding with encoded_read, encoded_edit and encoded_write; restores the UTF-8 BOM that edit, write and apply_patch drop and keeps CRLF files CRLF on write; appends the detected encoding to invalid-UTF-8 errors; and denies writes that introduce mojibake (U+FFFD, 锟斤拷, UTF-8 read as GBK or Latin-1).

Overview

Reads and edits GBK/GB18030, Big5, Shift_JIS, EUC-KR and UTF-16 files in their own encoding with encoded_read, encoded_edit and encoded_write; restores the UTF-8 BOM that edit, write and apply_patch drop and keeps CRLF files CRLF on write; appends the detected encoding to invalid-UTF-8 errors; and denies writes that introduce mojibake (U+FFFD, 锟斤拷, UTF-8 read as GBK or Latin-1).

Installation

Install from GitHub

dsh plugin --profile web add github:qinghuidaqzp/dsh-encoding-guard

Installing from GitHub runs the project's build script, which pnpm blocks until you allowlist it — run the command once and pnpm prints the exact key to add under `allowBuilds` in ~/.dsh/profiles/web/pnpm-workspace.yaml.

Version compatibility

Compatibility is unconfirmed. Check the project documentation for supported versions.

Installation notes

  • May run terminal commands