2.2.1. Ensure the correct encoding of all characters

In order to obtain the correct rendering of text content, a declaration of the character set must be included on each page. In the following example, the <meta> tag is used.

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    […]
</head>

This <meta> tag must be inserted as high as possible in the HTML page, before any content that is displayed on the screen, and preferably immediately after the opening <head> tag.

Warning

Remember also to check the correct coding of characters that are not automatically displayed on the screen, especially:

  • Content of the title attributes.
  • Text that is hidden by default.
  • Content of the alt attributes of images.
  • Etc.

HTML5

HTML5 simplifies the writing of the <meta> tag for the declaration of the character set. If you choose this type of document, you just need to use a statement like: <meta charset=“UTF-8”>.

notices/html-css/veiller-au-bon-encodage-de-tous-les-caracteres.txt · Last modified: 30 December 2013 at 17:33 by Sébastien Delorme (Atalan)
 

Project coordinated by Atalan.

In partnership with:

Observers: