french characters getting mangled from html form to php mail

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mjorld
Forum Newbie
Posts: 5
Joined: Mon Apr 19, 2010 10:28 am

french characters getting mangled from html form to php mail

Post by mjorld »

I have looked all over, and it sounds like I am far from the only person to have this problem, yet no one's solution has worked for me :banghead: . I am hoping someone out there has a brilliant solution.

I have an HTML form. Once filled out, the values are taken by some php code using $_POST. These values are then used in a personalized email sent using php's mail(). The problem is that the french characters such as é turn into garbage like é. The HTML begins with
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
and the php has as a header
$headers .= "Content-type:text/html;charset=UTF-8"."\r\n";
Initially I had problems with the hard-coded portions of the email, but replaced é with &#233; etc. That solved that problem. It is just the values that were input by the user and sent to the email body that get converted into garbage.

I have found tons of suggestions in this forum and others and tried most of them with no success. I know there must be a strqight-forward way of doing this.

Any help anyone can provide would be most appreciated.
Post Reply