Why does opening text with the wrong encoding produce garbled characters?
Quick answer
Text is stored as bytes, and a character encoding defines how those bytes map to characters. If software decodes the bytes using an incompatible encoding, the displayed characters may be wrong—a symptom often called mojibake. Compare the underlying text with the same bytes decoded using the intended encoding. If the characters are correct but their visual forms are missing or substituted, investigate font coverage or rendering instead. [S1] [S2]
The question, the details, the next step.
A practical checklist
Record the expected text and the exact characters or symbols that appear instead.
Note which file or source and which application show the problem.
Check whether all text is affected or only particular characters.
Compare the same bytes using the known intended encoding, if it is available.
If the underlying characters are correct but their forms are missing or substituted, investigate font coverage or rendering.
Mark the cause as uncertain when the intended encoding or underlying text cannot be established.
A few more useful answers
Does garbled text prove that the file’s encoding is wrong?
No. Mojibake is a symptom associated with incorrect character-set interpretation, but appearance alone does not establish the cause. Compare the underlying text and, if possible, the same bytes interpreted with the known intended encoding. [S1]
Can a font issue make characters look wrong even when the text is correct?
What if I cannot find out which encoding was intended?
Record the expected and observed text, the application, and what comparisons you tried. Treat any proposed encoding as a hypothesis rather than a confirmed fix until you can compare against reliable information about the intended encoding.
Sources
References used for this guide.
- [S1] Character encoding — MDN Glossary developer.mozilla.org · Checked
- [S2] Glyph — MDN Glossary developer.mozilla.org · Checked
