Author Topic: accented characters in mail  (Read 204 times)

0 Members and 1 Guest are viewing this topic.

Offline digitalecartoonsTopic starter

  • Enthusiast
  • Posts: 54
    • View Profile
accented characters in mail
« on: March 13, 2010, 03:50:42 PM »
I've made a flash form which uses this script to send the input by mail:
<?php
// initialize variables for To and Subject fields
$to 'info@testing.nl';
$subject 'Een testmail';
$from $_POST["from"];
$email $_POST["email"];
$comments $_POST["comments"];

// build message body from variables received in the POST array
$message "Van: $from \n\n";
$message .= "Email: $email \n\n";
$message .= "Bericht: $comments";
$message stripslashes($message);

//convert flash line breaks
$messagestr_replace("\r""\n"$message);
$message=nl2br($message);

// add additional email headers for more user-friendly reply
$additionalHeaders  "From: $from <".$email.">\r\n";
$additionalHeaders .= "Reply-To: ".$email."\r\n";
$additionalHeaders .= "MIME-Version: 1.0\r\n";
$additionalHeaders .= "Content-type: text/html; charset=utf-8\r\n";


// send email message
$OK mail($to$subject$message$additionalHeaders);
// let Flash know what the result was
if ($OK) {
  echo 
'sent=OK';
  }
  else {
  echo 
'sent=failed&reason='urlencode('Er is een probleem met de server. Probeer het later nog eens.');
  }
?>


Works a bit besides accented characters like é ë ä ó ö ú etc. For example: when I use 'René' in the From field it arrives like 'RenX', but in text mode as in html mode. The From fiels displays 'RenX' I mean.

When in text mode, the body text of the email displays 'René' however.

When I view the mail in html mode, it also displays 'RenX' in the From field, but the body text displays 'rené'.

How to I make it display René both in the From field and the body text? And both in text mode as in html mode?

Offline ocpaul20

  • Enthusiast
  • Posts: 153
  • Gender: Male
    • View Profile
    • What Causes Stress?
Re: accented characters in mail
« Reply #1 on: March 13, 2010, 07:23:19 PM »
I would suggest that you use an email client that you know works and send yourself a message with the correct information in it.

Then when it gets to you, have a look at the message source and find out how it is done. Probably setting character encoding in a different place or something like that?