1

我有一个显示考试(希伯来语)的 php 页面,它显示正确,在底部我有一个考试的发送邮件按钮给自己。

问题在于,在我将邮件发送给自己之后,邮件是希伯来语的,但是我看到了一些字母“�”。

字符集:

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

我的标题字符集也在 UTF-8 中,我也尝试了 ISO-8859-1,但它给了我同样的结果。

最奇怪的是,当我将标题字符集更改为 Big5(中文)时,我需要在我的电子邮件乱码中看到,但我看到了相同的消息

4

1 回答 1

0

这是我的代码:

$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);

这就是它在希伯来语中的样子(我希望你理解希伯来语)

在浏览器中(正确)--->“אחת שתים בדיקה אחת שתים בדיקה”

在电子邮件中(不正确)--->“אחת שת�ם בדיקה אחת שתים בדי�קה”

于 2012-11-13T15:48:14.320 回答