Dans le cours php de Guillaume Rossolini, VI-A-1, dans l'exemple suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
 
$body = "test";
$charset = "ISO-8859-1"; // ou UTF-8
 
?>
<?xml version="1.0" encoding="<?php echo $charset; ?>"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr-FR" lang="fr-FR">
<head>
    <title><?php echo $title; ?></title>
    <meta
        http-equiv="content-type"
        content="text/html; charset=<?php echo $charset; ?>" />
</head>
<body>
<?php echo $body; ?>
</body>
</html>
Le code ne fonctionne que sans la ligne (testé aussi avec UTF-8) ? :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
<?xml version="1.0" encoding="<?php echo $charset; ?>"?>