← ClaudeAtlas

windows-utf8-text-hygienelisted

Normalize and verify text-file encodings on Windows, especially Japanese content: repo text = UTF-8 without BOM, LF, no trailing whitespace, no NUL bytes. Use on symptoms like mojibake / garbled Japanese (文字化け), a UTF-8 BOM appearing in diffs, CRLF creeping into a repo, git diff --check trailing-whitespace warnings, ripgrep saying "binary file matches" (a NUL byte) or "pattern contains \0 but it is impossible to match", Windows PowerShell 5.1 breaking on a BOM-less UTF-8 .ps1 with Japanese comments (parse errors or silently skipped statements), PowerShell backtick expansion turning `t / `f into TAB / form feed inside generated Markdown, or hook stdout emitting garbled Japanese. Includes a strict UTF-8 decode guard (DecoderFallbackException) that stops lenient reads from irreversibly destroying ANSI / CP932 (Shift_JIS) files via silent U+FFFD replacement.
h8nc4y/windows-utf8-text-hygiene · ★ 0 · Code & Development · score 72
Install: claude install-skill h8nc4y/windows-utf8-text-hygiene
# Windows UTF-8 Text Hygiene Procedure for normalizing and verifying text-file encodings on Windows, aimed at repositories that carry Japanese (or any non-ASCII) content. The convention it enforces: **repository text files are UTF-8 without BOM, LF line endings, no trailing whitespace, no NUL bytes** — with one deliberate exception for Windows PowerShell 5.1 scripts, explained below. The core of the skill is ordering: inspect non-destructively first, normalize only what passes a strict UTF-8 decode, prevent corruption at generation time, and verify again after every append. ## When To Use - After writing or appending Japanese text to a repository's Markdown, docs, or scripts, as the post-edit verification step. - When `git diff --check` warns about trailing whitespace, or CRLF shows up in a diff. - When Japanese renders as mojibake (garbled characters such as `縺` or `?`), or ripgrep/grep starts reporting `binary file matches` — a sign of NUL-byte contamination. - When a code span in PowerShell-generated Markdown is broken — `` `t `` became a TAB, `` `f `` became a form feed (backtick expansion). - When adding a Japanese comment to a `.ps1` executed by Windows PowerShell 5.1 caused a parse error — or worse, a statement silently stopped executing. - When Japanese written to hook stdout (for example agent-harness hooks configured in a settings file) arrives garbled on the reading side. ## Ground Rules - Repository text files are **UTF-8 without BOM + LF + n