---
name: deploy-ps1-changelog-encoding-bug
description: DEPLOY.ps1 stub-append was mojibaking CHANGELOG.md — fixed in 715742e; flag if it ever resurfaces
metadata:
  node_type: memory
  type: project
  originSessionId: 43377483-fbd1-46da-8b7e-3def99e94767
---

**Status:** Fixed in commit `715742e` (2026-05-20). Watch for regression.

DEPLOY.ps1 stub-append step (Phase 34 D-08 round 2 / first `-Bump` run) used to read + rewrite CHANGELOG.md with the default Windows ANSI codepage (cp1252) instead of UTF-8. Side effect: every existing em-dash (`—`, U+2014) and other non-ASCII char in earlier entries got double-encoded into mojibake (`â€"`, `Ã¢â€"`, etc.) in the working tree as part of appending the new `## [X.Y.Z] - YYYY-MM-DD\n\n- TODO: changelog entry` stub. First observed: 2026-05-20 v1.10.20 → v1.10.21 bump.

**Why it happened:** PowerShell 5.1 `Get-Content -Raw` defaults to the OS ANSI codepage on Windows; .NET `[System.IO.File]::WriteAllText(path, content)` defaults to UTF-8 *with* BOM. The stub-append path didn't force either.

**Fix in 715742e:** Both `Get-Content $ChangelogPath -Raw` sites now pass `-Encoding UTF8`. The `WriteAllText` call now uses `New-Object System.Text.UTF8Encoding($false)` so the on-disk no-BOM convention is preserved.

**How to apply:** After running `DEPLOY.ps1 -Bump <patch|minor|major>` first run, BEFORE editing the stub into a curated entry, `git diff CHANGELOG.md` to confirm only the new H2 stub block was added. If existing entries show mojibake in the diff (e.g. `â€"` where the source had `—`), the fix has regressed — `git checkout CHANGELOG.md` to discard, hand-append via the Edit tool, and re-inspect the three CHANGELOG.md I/O sites in DEPLOY.ps1 (currently around lines 254, 291, 317).
