Skip to content

fix(compliance): restore corrupted em-dashes and detect CP437 mojibake - #183

Closed
v0lkan wants to merge 1 commit into
mainfrom
fix/mojibake-cp437
Closed

v0lkan wants to merge 1 commit into
mainfrom
fix/mojibake-cp437

Conversation

@v0lkan

@v0lkan v0lkan commented Oct 6, 2026

Copy link
Copy Markdown
Member

Every em-dash in compliance_test.go's section headers had been
double-encoded through CP437 (the Windows console code page) into a
six-character garble, 21 times over. TestNoMojibake, which lives in
that same file, matched only the Windows-1252 signature (C3 A2 E2),
so it passed on its own corruption.

Restore the em-dashes and give the detector two more signatures:
single CP437 (CE 93 C3) and CP437 applied twice (E2 95 AC C3 B4).
Each is the garbled form of UTF-8 lead byte 0xE2, which every
dash, quote, ellipsis, and arrow shares, so none occurs in real
text. The failure message names the code page. The doc comment
spells its examples as code points, since the literal forms would
trip the test on its own file.

Also: build the failure-context slice with max/min (the old code
gave no leading context for a match in the first 20 bytes), and
make the allGoFiles doc comment list all five skipped directories
instead of only vendor/.

Spec: specs/mojibake-cp437-detection.md

🤖 Generated with Claude Code

Every em-dash in compliance_test.go's section headers had been
double-encoded through CP437 (the Windows console code page) into a
six-character garble, 21 times over. TestNoMojibake, which lives in
that same file, matched only the Windows-1252 signature (C3 A2 E2),
so it passed on its own corruption.

Restore the em-dashes and give the detector two more signatures:
single CP437 (CE 93 C3) and CP437 applied twice (E2 95 AC C3 B4).
Each is the garbled form of UTF-8 lead byte 0xE2, which every
dash, quote, ellipsis, and arrow shares, so none occurs in real
text. The failure message names the code page. The doc comment
spells its examples as code points, since the literal forms would
trip the test on its own file.

Also: build the failure-context slice with max/min (the old code
gave no leading context for a match in the first 20 bytes), and
make the allGoFiles doc comment list all five skipped directories
instead of only vendor/.

Spec: specs/mojibake-cp437-detection.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
@v0lkan
v0lkan requested a review from josealekhine as a code owner October 6, 2026 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants