Charset Should Be UTF-8

ID

html.charset_not_utf8

Severity

low

Remediation Complexity

low

Remediation Risk

low

Remediation Effort

low

Resource

Reliability

Language

Html

Tags

reliability

Description

Flags a <meta charset="…​"> whose value is neither utf-8 nor utf8.

Rationale

UTF-8 is the encoding the HTML standard mandates for the whole web platform: it covers every script, avoids the data loss of legacy single-byte encodings, and sidesteps the encoding-confusion class of cross-site-scripting bugs. A page still declaring a legacy charset such as iso-8859-1 or windows-1252 is a portability and correctness hazard.

<meta charset="iso-8859-1">     <!-- FLAW — legacy encoding -->
<meta charset="windows-1252">   <!-- FLAW — legacy encoding -->

<meta charset="utf-8">          <!-- OK -->
<meta charset="UTF-8">          <!-- OK — case-insensitive -->

Remediation

Change the declaration to <meta charset="utf-8"> and save the file as UTF-8.