Accented characters appearing as question marks in a unicoded mail
| From: | nicolas | Date: | Thu, 17 Oct 2002 22:26:56 +0000 |
| Subject: | Accented characters appearing as question marks in a unicoded mail | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-120440@lists.php.net to get a copy of this message | ||
Well, here it is, I've set up a code for sending a form that goes a little something like this:
<?php
if($_POST['okList'] == 1) {
$fp = fopen("log/emailLog.txt", "a");
$wp = fwrite($fp, $_POST['Email'] . "\r\n");
}
$from = $_POST['Name'] . "<" . $_POST['Email'] . ">";
$to = "dorobo88@digitalmilitia.net";
$subject = "Demande de renseignement";
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=utf-8\r\n";
$headers .= "From: " . $from . "\r\n";
$tmpBody = "Nom: " . $_POST['Name'] . "\n";
$tmpBody .= "Entreprise: " . $_POST['Ent'] . "\n";
$tmpBody .= "Adresse: " . $_POST['Address'] . "\n";
$tmpBody .= "Ville: " . $_POST['City'] . "\n";
$tmpBody .= "Province: " . $_POST['Province'] . "\n";
$tmpBody .= "Pays: " . $_POST['Country'] . "\n";
$tmpBody .= "Code Postal/Zip: " . $_POST['Zip'] . "\n";
$tmpBody .= "Message:\n" . $_POST['Message'] . "\n";
$tmpArr = explode(',', urldecode($_POST['Attach']));
$tmpBody .= "Catalogue(s) demandé(s):\n";
foreach($tmpArr as $cat) {
$tmpBody .= $cat . "\n";
}
$body = nl2br($tmpBody);
$ok_mail = mail($to, $subject, $body, $headers);
echo($ok_mail . $body);
?>
everything works fine EXCEPT the "é" from "demandé" that is displayed as a "?" in the output mail.
thks for any tip or help
nicolas