Repository navigation
fix(compliance): restore corrupted em-dashes and detect CP437 mojibake - #186
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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