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 <quiz@quiz.dk>\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");
?>
Link to comment
Share on other sites

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,
Link to comment
Share on other sites

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"
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.