# Unmappable byte sequence: X.

> Canonical HTML version: https://rocketvalidator.com/html-validation/unmappable-byte-sequence-x
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The document was decoded with a legacy encoding, usually `windows-1252`, and contains a byte that has no character in that encoding.

A character encoding maps bytes to characters. In `windows-1252`, five byte values map to nothing: `81`, `8d`, `8f`, `90` and `9d`. The message gives the byte that failed in hexadecimal.

Most of the time the file is saved as UTF-8, but nothing says so. With no `<meta charset>` in the page and no `charset` in the HTTP `Content-Type` header, the validator has to guess the encoding and often picks `windows-1252`. UTF-8 stores accented letters as two bytes, and for some of them the second byte is one of the unmapped values: `Í` is `c3 8d` and `č` is `c4 8d`. Read as `windows-1252`, the first byte turns into the wrong character (`Ã` or `Ä`) and the second can't be decoded at all. A browser that guesses the same way shows that garbled text to visitors.

Declare UTF-8 with `<meta charset="utf-8">` as the first element inside `<head>`. This also clears the "The character encoding was not declared" error that usually comes with this one. If the server sends a `Content-Type` header with a legacy charset such as `iso-8859-1`, change the server configuration as well, because the header takes priority over the `<meta>` element.

If the file really is saved as `windows-1252`, the byte is broken data, often from text pasted out of a document in another encoding. Convert the file to UTF-8, then find the damaged character and type it again.

## Invalid example

A file saved as UTF-8 and served without a charset:

```html
<!DOCTYPE html>
<html lang="es">
  <head>
    <title>Índice</title>
  </head>
  <body>
    <h1>Índice</h1>
  </body>
</html>
```

## Valid example

```html
<!DOCTYPE html>
<html lang="es">
  <head>
    <meta charset="utf-8">
    <title>Índice</title>
  </head>
  <body>
    <h1>Índice</h1>
  </body>
</html>
```
