JGJS2026/AGENTS.md
2026-03-05 17:58:38 +08:00

1.1 KiB

AGENTS.md — Encoding & Chinese Safety Rules

Absolute rules (must follow)

  1. Never corrupt non-ASCII text (Chinese, emoji, etc.). Preserve exact Unicode characters.
  2. NEVER rewrite entire files when only small edits are needed. Always apply minimal diffs/patches.
  3. If a file contains Chinese characters, do not “normalize”, “escape”, “re-encode”, or “replace” them.
  4. When reading/writing files via scripts/tools, always use UTF-8 explicitly (no platform default encoding).

Windows / PowerShell rules

  • If you need to run PowerShell, force UTF-8 output/input:
    • Use: [Console]::OutputEncoding = [System.Text.UTF8Encoding]::new()
    • Prefer Set-Content -Encoding utf8 / Out-File -Encoding utf8
  • Avoid commands that may round-trip through ANSI/CP936/CP1252 without explicit encoding.

Workflow

  • Before editing: inspect the target lines only.
  • Apply changes as a patch (line-level edits), not full-file regeneration.
  • After editing: verify the edited lines still show correct Chinese.
  • If uncertain: stop and ask rather than guessing and corrupting text.