Character encoding is the system that maps the characters you type to the bytes a computer stores. UTF-8 is the dominant standard on the web because it can represent every character in every language — plus emoji — while staying compact for plain English.
When text shows up as garbled symbols (mojibake), it's usually an encoding mismatch.
Count characters and words with the word counter.
The underlying problem
Computers store numbers. Text is a mapping from numbers to characters, and character encoding is that mapping. If text is written with one mapping and read with another, the numbers survive and the meaning does not — which is why an encoding mismatch produces recognisable garbage rather than an error.
ASCII, then chaos, then Unicode
ASCII defined 128 characters, enough for English and no more. The gap was filled by dozens of incompatible extensions — Latin-1 for Western Europe, Latin-2 for Central Europe, Windows-1252, various others — each mapping the same numbers to different characters. A file was only readable if you knew which one it used, and nothing recorded that. Unicode resolved it by assigning every character in every writing system a unique number, currently covering around 150,000 of them.
UTF-8 and why it won
Unicode assigns numbers; an encoding decides how to store them as bytes. UTF-8 uses one byte for ASCII characters, two to four for everything else. That makes English text byte-identical to ASCII, so decades of existing files and software kept working, while the rest of the world's writing became representable. It is now the encoding of well over 95% of the web, and the correct default for essentially anything new.
Recognising a mismatch
The symptoms are diagnostic. Seeing é where you expected é means UTF-8 bytes are being read as Latin-1. Seeing a question mark in a black diamond means the bytes were not valid in the encoding used to read them. Seeing a rectangle usually means the encoding is right but the font has no glyph for that character. And an invisible character at the very start of a file, which breaks the first line of a CSV or a JSON parse, is normally a byte order mark.
The characters you cannot see
Text pasted from a website or a word processor routinely carries characters that look exactly like a space but are not — non-breaking spaces, zero-width joiners, narrow no-break spaces. They survive copying, are invisible on screen, and cause failures that look inexplicable: a search finding nothing, an import rejecting a row, a name refusing to match a record. Normalising them back to plain equivalents before text reaches a system that cares is most of what text cleaning actually does.