Character Encoding and Garbled Text

Character encoding is the agreement that maps stored bytes to text. Unicode defines the characters; encodings such as UTF-8 and UTF-16 define how their code points become bytes or code units.

Common Encoding Symptoms

SymptomLikely causeFirst check
é instead of éUTF-8 decoded as a Western single-byte encodingResponse header and database connection charset
� replacement characterInvalid, missing, or undecodable bytesOriginal byte source before conversion
Empty square or tofu glyphFont lacks a glyphTry a font with broader Unicode coverage
Question marks saved permanentlyDestination encoding could not represent charactersDatabase column and connection encoding

Keep the Entire Pipeline Consistent

The editor, source file, web server, HTML declaration, application runtime, database connection, database columns, APIs, and export files should agree on Unicode. One mismatched step can corrupt text even when every other component uses UTF-8.

Do not repeatedly encode already encoded text or decode bytes without knowing their source encoding. Preserve the original data while diagnosing a problem.