Skip to content

fix: repair mojibake introduced by the American English pass - #7

Merged
ghosteau merged 2 commits into
devfrom
fix/mojibake
Sep 3, 2026
Merged

fix: repair mojibake introduced by the American English pass#7
ghosteau merged 2 commits into
devfrom
fix/mojibake

Conversation

@ghosteau

@ghosteau ghosteau commented Sep 3, 2026

Copy link
Copy Markdown
Owner

That pass was scripted with PowerShell, and Get-Content -Raw decodes as the ANSI codepage on Windows PowerShell 5.1 rather than UTF-8. Every non-ASCII character round-tripped through cp1252 and was re-encoded, so the ellipsis and arrow characters turned into "a-hat" sequences -- visible in the legend ("768D -> 3D") and in the projection loading message. The result is still valid UTF-8, so it compiled, passed tests, and shipped.

cp1252 has undefined byte values that decode to U+FFFD, so the transform loses information and cannot be reversed byte-for-byte. The five affected files are instead restored from 4f7c116, the commit before the pass; nothing has touched them since. Set-Content -Encoding utf8 had also added BOMs to three further files, which are stripped here.

Adds scripts/check_encoding.py and wires it into CI as its own job. This class of corruption is invisible to both the type-checker and the test suite -- the only symptom is garbage in the rendered UI -- so it needs a check that looks at the bytes. Verified it fails on reintroduced corruption and passes on the repaired tree.

That pass was scripted with PowerShell, and Get-Content -Raw decodes as the
ANSI codepage on Windows PowerShell 5.1 rather than UTF-8. Every non-ASCII
character round-tripped through cp1252 and was re-encoded, so the ellipsis
and arrow characters turned into "a-hat" sequences -- visible in the legend
("768D -> 3D") and in the projection loading message. The result is still
valid UTF-8, so it compiled, passed tests, and shipped.

cp1252 has undefined byte values that decode to U+FFFD, so the transform
loses information and cannot be reversed byte-for-byte. The five affected
files are instead restored from 4f7c116, the commit before the pass; nothing
has touched them since. Set-Content -Encoding utf8 had also added BOMs to
three further files, which are stripped here.

Adds scripts/check_encoding.py and wires it into CI as its own job. This
class of corruption is invisible to both the type-checker and the test suite
-- the only symptom is garbage in the rendered UI -- so it needs a check that
looks at the bytes. Verified it fails on reintroduced corruption and passes
on the repaired tree.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ghosteau ghosteau added the bug Something isn't working label Sep 3, 2026
The first CI run failed on the checker's own source. Its patterns are, by
definition, the character sequences it hunts for, so spelling them literally
made the file trip its own check -- and the U+FFFD constant did the same.

Excluding the file from the scan would have been the easy fix, but then
genuine corruption in it would go unnoticed. Instead the patterns are built
from numeric code points, so the source stays pure ASCII and the checker can
scan itself like any other file.

Verified: source is ASCII, the code points still decode to the intended
pairs, all four sample corruptions are matched, exit 1 on injected
corruption and exit 0 on the clean tree.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ghosteau
ghosteau merged commit 0ec4229 into dev Sep 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant