diggchina
2006-04-05, 06:26 PM
問题: 由 IPB 論壇程式中所寄出的電子郵件若有包含中文字在 Gmail會出現?y碼。
原因: 由於 class_email.php 中未針對信件內容不是 HTML時的編碼方式,以及預設的編碼方式是 iso-8859-1。
修改方式 :
1.開啟修改檔案
/sources/classes/class_email.php
2. 變更語系
尋找 $char_set = 'iso-8859-1'; (約在行 54)
修改為 : $char_set = 'GB2312';
3. 修改純文字信件編碼方式 :
尋找 (約在 156行)
程式碼
改為:
程式碼
4. 存檔
5.完成修改。
-------------------
转自:Sanko http://www.dkyu.idv.tw/forums/ipb/
原因: 由於 class_email.php 中未針對信件內容不是 HTML時的編碼方式,以及預設的編碼方式是 iso-8859-1。
修改方式 :
1.開啟修改檔案
/sources/classes/class_email.php
2. 變更語系
尋找 $char_set = 'iso-8859-1'; (約在行 54)
修改為 : $char_set = 'GB2312';
3. 修改純文字信件編碼方式 :
尋找 (約在 156行)
程式碼
代码:
//-----------------------------------------
// HTML (hitmuhl)
//-----------------------------------------
if ( $this->html_email )
{
$this->mail_headers .= "MIME-Version: 1.0\n";
$this->mail_headers .= "Content-type: text/html;
charset=\"".$this->char_set."\"\n";
}
程式碼
代码:
//-----------------------------------------
// HTML (hitmuhl)
//-----------------------------------------
if ( $this->html_email )
{
$this->mail_headers .= "MIME-Version: 1.0\n";
$this->mail_headers .= "Content-type: text/html;
charset=\"".$this->char_set."\"\n";
}
else{ // 修改存文字語系與編碼方式
$this->mail_headers .= "MIME-Version: 1.0\n";
$this->mail_headers .= "Content-type: text/plain;
charset=\"".$this->char_set."\"\n";
$this->mail_headers .="Content-Transfer-Encoding: 8bit.''.\"\n";
}
5.完成修改。
-------------------
转自:Sanko http://www.dkyu.idv.tw/forums/ipb/