Bonjour,

Je rencontre un problème d'encodage avec PHP et Outlook. Ce problème n'est pas permanent, il se produit de manière aléatoire.
Le but est d'afficher une page web dans un message Outlook. Les données de la page web sont extraites d'une base de données MySQL dont le jeu de caractères est UTF-8 :

Nom : Mysql.PNG
Affichages : 166
Taille : 8,6 Ko

L'encodage de la page PHP s'effectue avec le code suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
header('Content-Type: text/html; charset=UTF-8');
L'affichage de la page web dans un navigateur quelconque ne présente aucun problème particulier.
C'est lorsque j'envoi le message que l'encodage pose parfois problème lors de l'ouverture du message dans Outlook : (capture d'écran)

Nom : erreurs.PNG
Affichages : 154
Taille : 19,1 Ko

Ci dessous un extrait de code (afficher la source) du message reçu :

Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
test.mpm.fr/updatePcg2Phase.php?Phase=Phase 1&amp;LigneProjet=&amp;Nom_projet=Finances : convergence vers SIFM (1/3)&amp;mail=pierre.rambaldi@ampmetropole.fr&amp;ChoixAgent1=6" target="_self"><input type="button" value="Phase 1"></a></td><td><a hre="" f="http://appccc-test.mpm.fr/updatePcg2Phase.php?Phase=Phase 2&amp;LigneProjet=&amp;Nom_projet=Finances : convergence vers SIFM (1/3)&amp;mail=pierre.rambaldi@ampmetropole.fr&amp;ChoixAgent1=6" target="_self"><input type="button" value="Phase 2"></a></td><td><a href="http://appccc-test.mpm.fr/updatePcg2Phase.php?Phase=Phase 3&amp;LigneProjet=&amp;Nom_projet=Finances : convergence vers SIFM (1/3)&amp;mail=pierre.rambaldi@ampmetropole.fr&amp;ChoixAgent1=6" target="_self"><input type="button" value="Phase 3"></a></td><td><a href="http://appccc-test.mpm.fr/updatePcg2Phase.php?Phase=Phase 5&amp;LigneProjet=&amp;Nom_projet=Finances : convergence vers SIFM (1/3)&amp;mail=pierre.rambaldi@ampmetropole.fr&amp;ChoixAgent1=6" target="_self"><input type="button" value="Phase 5"></a></td><td><a href="http://appccc-test.mpm.fr/updatePcg2Phase.php?Phase=Terminé&amp;LigneProjet=&amp;Nom_projet=Finances : convergence vers SIFM (1/3)&amp;mail=pierre.rambaldi@ampmetropole.fr&amp;ChoixAgent1=6" target="_self"><input type="button" value="Terminé"></a></td>&lt;
 /tr&gt;<tr><td style="text-align:center;">75</td><td style="text-align:center;">C15032</td><td style="text-align:center;">FI</td><td style="text-align:left;width:500px;">SEDIT-MARIANNE / ASTRE

On peut voir en rouge le code parfois "mal écrit" qui est écrit normalement dans le reste de la page.

Extrait du code de la page PHP :

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
21
22
23
24
25
26
27
28
29
30
    // Colonne phase : Phase 3
    . '<td>';
    $message = html_entity_decode($message);
    $Phase = 'Phase 3';
    $message= $message. '<a href="http://appccc-test.mpm.fr/updatePcg2Phase.php?Phase=' . $Phase . '&LigneProjet=' . $LigneProjet . '&Nom_projet=' . $data['Nom_projet'] . '&mail=' . $mail . '&ChoixAgent1=' . $ChoixAgent . '" target="_self"><input type="button" value ="Phase 3" ></a>'
    . '</td>'
    // Colonne phase : Phase 5
    . '<td>';
    $message = html_entity_decode($message);
    $Phase = 'Phase 5';
    $message= $message. '<a href="http://appccc-test.mpm.fr/updatePcg2Phase.php?Phase=' . $Phase . '&LigneProjet=' . $LigneProjet . '&Nom_projet=' . $data['Nom_projet'] . '&mail=' . $mail . '&ChoixAgent1=' . $ChoixAgent . '" target="_self"><input type="button" value ="Phase 5" ></a>'
    . '</td>'
    // Colonne phase : Terminé
    . '<td>';
    $message = html_entity_decode($message);
    $Phase = 'Terminé';
    $message= $message. '<a href="http://appccc-test.mpm.fr/updatePcg2Phase.php?Phase=' . $Phase . '&LigneProjet=' . $LigneProjet . '&Nom_projet=' . $data['Nom_projet'] . '&mail=' . $mail . '&ChoixAgent1=' . $ChoixAgent . '" target="_self"><input type="button" value ="Terminé" ></a>'
    . '</td>'
    . '</tr>' ; 
    $message = html_entity_decode($message);
    }
    $message= $message. '</table>';
    $message= $message. '</form>';
 
    $subject = 'Avancement Projets';
    $headers[] = 'MIME-Version: 1.0';
    $headers[] = 'Content-Type: text/html; charset="UTF-8"';
    $headers[] = 'From: PCG@ampmetropole.fr';
    mail("To:<" . $mail . ">", $subject, $message, implode("\r\n", $headers))
    $db = null;
Quelle peut être la solution à ce problème?

Cordialement,

Pierre