Accents en php
Résolu
gilbertgibert
Messages postés
67
Date d'inscription
Statut
Membre
Dernière intervention
-
gilbertgibert Messages postés 67 Date d'inscription Statut Membre Dernière intervention -
gilbertgibert Messages postés 67 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
j'utilise un script php pour envoyer un formulaire par e-mail.
Cela fonctionne correctement sauf pour les caractères accentués saisis dans le formulaire.
J'ai fait de nombreux essais sans résultat.Qui a la solution ?
Merci
j'utilise un script php pour envoyer un formulaire par e-mail.
Cela fonctionne correctement sauf pour les caractères accentués saisis dans le formulaire.
J'ai fait de nombreux essais sans résultat.Qui a la solution ?
Merci
A voir également:
- Accents en php
- Easy php - Télécharger - Divers Web & Internet
- Expert php pinterest - Télécharger - Langages
- Lettres avec accents - Guide
- Php alert - Forum PHP
- Comment faire les accents sur le clavier - Forum Clavier
7 réponses
Voici mon script:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset= UTF-8"/>
<title>Document sans nom</title>
</head>
<body>
<?php
$TO = "mon email@truc.fr";
$h = "From: " . $TO;
$message = "";
while (list($key, $val) = each($HTTP_POST_VARS)) {
$message .= "$key : $val\n";
}
mail($TO, $subject, $message, $h);
?>
<p style="text-align: left;">
<input type="button" name="contact" value="Retour" onclick=window.open("index.html",'_self');
)>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset= UTF-8"/>
<title>Document sans nom</title>
</head>
<body>
<?php
$TO = "mon email@truc.fr";
$h = "From: " . $TO;
$message = "";
while (list($key, $val) = each($HTTP_POST_VARS)) {
$message .= "$key : $val\n";
}
mail($TO, $subject, $message, $h);
?>
<p style="text-align: left;">
<input type="button" name="contact" value="Retour" onclick=window.open("index.html",'_self');
)>
</body>
</html>
Voici mon script, je ne vois pas ce que je peux faire
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset= UTF-8"/>
<title>Document sans nom</title>
</head>
<body>
<?php
$TO = "truc@bidule.fr";
$h = "From: " . $TO;
$message = "";
while (list($key, $val) = each($HTTP_POST_VARS)) {
$message .= "$key : $val\n";
}
mail($TO, $subject, $message, $h);
echo "<P align=left>";
echo "Votre formulaire a bien été envoyé !</P>";
echo "</BODY></HTML>";
?>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset= UTF-8"/>
<title>Document sans nom</title>
</head>
<body>
<?php
$TO = "truc@bidule.fr";
$h = "From: " . $TO;
$message = "";
while (list($key, $val) = each($HTTP_POST_VARS)) {
$message .= "$key : $val\n";
}
mail($TO, $subject, $message, $h);
echo "<P align=left>";
echo "Votre formulaire a bien été envoyé !</P>";
echo "</BODY></HTML>";
?>
</body>
</html>
Essaye de changer ton charset
par
<meta http-equiv="Content-Type" content="text/html; charset= iso-8859-1\n"/>
par
<meta http-equiv="Content-Type" content="text/html; charset= iso-8859-1\n"/>
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
Tu as essayé de mettre des choses dans ce genre? :
$entetes.= "MIME-version: 1.0\n";
$entetes.= "Content-type: multipart/mixed; ";
$entetes.= "boundary=\"Message-Boundary\"\n";
$entetes.= "Content-transfer-encoding: 7BIT\n";
$body_top = "--Message-Boundary\n";
$body_top .= "Content-type: text/plain; charset=iso-8859-1\n";
$body_top .= "Content-transfer-encoding: 7BIT\n";
$body_top .= "Content-description: Mail message body\n\n";
$msg .= "\n\n--Message-Boundary\n";
$msg .= "Content-type: $attach_type; name=\"$attach_name\"\n";
$msg .= "Content-Transfer-Encoding: BASE64\n";
$msg .= "Content-disposition: attachment; filename=\"$attach_name\"\n\n";
$msg .= "$encoded_attach\n";
$msg .= "--Message-Boundary--\n";
$entetes.= "MIME-version: 1.0\n";
$entetes.= "Content-type: multipart/mixed; ";
$entetes.= "boundary=\"Message-Boundary\"\n";
$entetes.= "Content-transfer-encoding: 7BIT\n";
$body_top = "--Message-Boundary\n";
$body_top .= "Content-type: text/plain; charset=iso-8859-1\n";
$body_top .= "Content-transfer-encoding: 7BIT\n";
$body_top .= "Content-description: Mail message body\n\n";
$msg .= "\n\n--Message-Boundary\n";
$msg .= "Content-type: $attach_type; name=\"$attach_name\"\n";
$msg .= "Content-Transfer-Encoding: BASE64\n";
$msg .= "Content-disposition: attachment; filename=\"$attach_name\"\n\n";
$msg .= "$encoded_attach\n";
$msg .= "--Message-Boundary--\n";