Detailed answer
Check file encoding, charset metadata, response headers, and any database or template transformations.
These stages must agree on how bytes represent text. Test a minimal UTF-8 document with representative characters to isolate the failure. Keep an undamaged original before attempting conversions rather than repeatedly re-encoding already corrupted text.
Example
<!doctype html><meta charset="utf-8"><title>Encoding check</title><p>नमस्ते — café — HTML</p>
Understanding the behavior
Encoding problems can begin when a file is saved, when a server declares its charset or when data is decoded before reaching the page. A replacement character or mojibake can already be stored in the content. Changing one meta tag cannot recover lost original bytes.
Practical implementation notes
Trace a short non-ASCII sample from its source through storage to the response. Keep the actual file encoding, database connection and HTTP declaration consistent, then correct any previously damaged text.
How to check it
Trace the original bytes through storage and HTTP response, keeping a clean source copy.
Expected result
The damaged stage is identified instead of applying repeated blind conversions.
Watch out: Character references can conceal a symptom without repairing the encoding pipeline.
Read the reference ↗