简体   繁体   中英

php diamond with question mark after send mail

i have a php page that display exam (in Hebrew) and it display it correctly and in the bottom i have a send mail button of the exam to myself.

the problem its that after i send the mail to my self the mail its in hebrew But some of the letters i see " " .

the charset its :

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

and my header charset its also in UTF-8 ,i also try ISO-8859-1 but it give me the same.

the most strange thing its when i change the header charset to Big5 (chinese) i need to see in my email gibberish but i see the same message

this is my Code:

$content = 
    writeExamDetails() .
    writeStudnetDetails() .
    writeAnswers($numOfQuestions);

    if ($_POST['studentComments']!=null) {
        $content .= "<p align=\"" . $text['align'] . "\"><strong>" . 
                    $text['studentComments'] .
                    ":</strong><br />" .
                    formatStr($_POST['studentComments']) . 
                    "</p>";
    }

    $body = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" >
    <html>
    <head>
    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />
    <title>" . 
    $text['emailResultsPageTitle'] . 
    "</title>
    <style>
    body {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.9em;
    direction: " . $text['dir'] . ";
    text-align: " . $text['align'] . ";
    }
    </style>
    </head>
    <body>
    <p dir=\"ltr\" style=\"color:#999999;\">
    If you cannot view the following contents properly, change the Encoding to Unicode (UTF-8).</p>" .
    $content;

    $body .= "<hr noshade=\"noshade\" height=\"1\" /><p>" . 
            $text['emailResultsDurationTitle'] . ": " . 
            duration((int)($_POST['lapsedTime']/1000)) .
            "</p>
            </body>
            </html>";

    $subject = "" . trim(stripslashes(stripslashes($_POST['examTitle'])));
                //formatStr2html($_POST['examTitle']);
    if (isset($_POST['studentId'])){
        $subject .= " (ID: " . $_POST['studentId'] . ")";
    }

    $headers = "From: " . $from . "\n" . $cc . 
                "Subject: " . $subject ."\n" .
                "X-Mailer: PHP/" . phpversion() . "\n" .
                "MIME-Version: 1.0\n" .
                "X-Priority: 1\n" . "Importance: High\n" . "X-MSMail-Priority: High\n" .
                "Content-Type: text/html; charset=iso-8859-1\n";
                "Content-Transfer-Encoding: 8bit\r\n\r\n";



    $result = mail ($to, $subject, $body, $headers);

and this is how its look in HEBREW (i hope you understand hebrew)

in browser (its correctly)---> "אחת שתים בדיקה אחת שתים בדיקה"

in email (not correctly) ---> "אחת שת ם בדיקה אחת שתים בדי קה"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM