UTF-8 vs ASCII, ISO-8859-1, and Windows-1252

Last updated: August 29, 2026.

UTF-8 is the appropriate default for modern web pages because it represents all Unicode characters. ASCII is a compatible subset. ISO-8859-1 and Windows-1252 are older single-byte encodings that are often confused.

Quick comparison

ASCII covers 128 basic characters. ISO-8859-1 defines 256 code positions. Windows-1252 uses printable characters in the 0x80-0x9F range where ISO-8859-1 defines controls. UTF-8 uses one to four bytes and covers all Unicode code points.

EncodingCoverageBest use
ASCIIBasic English and controlsRestricted protocols
ISO-8859-1Legacy Western European setKnown legacy imports
Windows-1252Legacy Windows Western textKnown legacy imports
UTF-8All UnicodeNew pages, APIs, files, and databases

Declare UTF-8 consistently

Save the file as UTF-8 and make the HTTP header, HTML declaration, database connection, and stored data agree. A declaration cannot repair bytes already saved in another encoding.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>UTF-8 page</title>
</head>
<body>Unicode text belongs here.</body>
</html>

Convert legacy data once

Identify the actual source encoding, keep a backup, and convert at the import boundary. Do not repeatedly guess and reconvert data at display time; that can turn a reversible mismatch into permanent corruption.

Choose an encoding deliberately

Use UTF-8 for new web pages, APIs, and database connections unless an external system requires a specific legacy encoding. The important requirement is consistency: the stored bytes, HTTP declaration, HTML declaration, and decoder must agree.

Test with characters that expose the difference, such as curly quotes, the euro sign, accented names, and emoji. A page that works only with plain English text has not demonstrated that its encoding path is correct.

  • Declare UTF-8 early in HTML.
  • Configure the database connection explicitly.
  • Keep the original bytes when diagnosing damaged text.

Keep the byte encoding, declaration, storage, and decoder consistent. When diagnosing a problem, preserve the original input and change one boundary at a time so the actual cause remains visible.

Continue with character sets reference, mojibake troubleshooting, and HTTP charset guidance.

Reference: WHATWG Encoding Standard.

admin

admin