Jump to content

Cant see specail chars (æøå) in my php mails


elnino_php

Recommended Posts

I am new to PHP but have pt together a simple script to send of a mail. The problem is that  when I receive the mail, I dont get the æøå characters.
I have looked everywhere now and cant find an answer.
Hope someone can help.

/M

My code
<?
$yourname = $_POST["yourname"]; /* nick name */
$yourmail = $_POST["yourmail"];
$friendname = $_POST["friendname"];
$friendmail = $_POST["friendmail"];
$to = $_POST["friendmail"];
$subject = "HiHi!";
$body = "
<html>
<head>
<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">
<title></title>
</head>
<body>
<TABLE HEIGHT=150 WIDTH=450 ><TR><TD WIDTH=150></TD><TD><i> æøåÆØÅ ". $friendname ." </i></TD></TR></TABle>
</body>
</html>";
$headers = "From: Quiz man <[email protected]>\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to, $subject, $body, $headers);
echo("Mail5 sendt");
?>
Email programs can have difficulty reading special characters.  Try using the html character codes for the special characters instead.  You would have to look them up because they are not exactly human friendly, but they can look something like this:

&#8225;

Hope this is what you are looking for,
Don't think utf-8 will work on those, try
[code]

<?php

$text = str_replace(array("Æ","æ","Ø","ø","Å","å"),array("& # 198;","& # 230;","& # 216;","& # 248;","& # 197;","& # 229;"),$text);

?>

[/code]

*EDIT* some problems getting them visually right displayed  in this board... Remove the spaces in the code between "& # foo"

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.