Mojibake signatures
Use this table when a diff, page or log shows short runs of accented capitals and currency symbols where punctuation should be. Each row is one original character, its UTF-8 bytes, what it turns into after one read-as-Windows-1252-and-save cycle, and the bytes now on disk. Why it happens: Text encoding and AI agents. Prevention: Prevent text encoding corruption.
One round of double encoding
| Character | Original code point and UTF-8 bytes | Shows up as | Bytes on disk after corruption |
|---|---|---|---|
em dash |
|
|
|
en dash |
|
|
|
left single quote |
|
|
|
right single quote / apostrophe |
|
|
|
left double quote |
|
|
|
right double quote |
|
|
|
ellipsis |
|
|
|
bullet |
|
|
|
right arrow |
|
|
|
no-break space |
|
|
|
degree sign |
|
|
|
copyright sign |
|
|
|
e acute |
|
|
|
u umlaut |
|
|
|
n tilde |
|
|
|
multiplication sign |
|
|
|
Two rounds (the corrupted file read and saved wrongly a second time) roughly double the length again; you will see long runs of à and  between the remnants of the original text.
Guard signatures
Three byte prefixes cover almost every case and almost never appear in legitimate text:
| Bytes | Looks like | Produced by |
|---|---|---|
|
|
Characters encoded |
|
|
Accented Latin letters encoded |
|
|
Characters encoded |
Other three-byte ranges also start with â but continue differently (arrows E2 86 xx become ↠plus a symbol; box drawing E2 94 xx becomes â” plus a symbol). Add signatures for those if your files use them.
Build them from escapes so the script itself stays ASCII:
sig_lead=$(printf '\303\242\342\202\254')
sig_atilde=$(printf '\303\203\302')
sig_acirc=$(printf '\303\202\302')
git grep -nIF -e "$sig_lead" -e "$sig_atilde" -e "$sig_acirc"
Related byte-level problems a guard should also reject or warn about:
| First bytes | Meaning | Typical source |
|---|---|---|
|
UTF-16 (or UTF-32) text; Git treats it as binary |
Windows PowerShell 5.1 |
|
UTF-8 with a byte-order mark |
Windows PowerShell 5.1 |
Lone bytes |
Windows-1252 or Latin-1 bytes in a file that claims UTF-8 |
|