如何修复此字符编码:
require_once(/Mail/mime.php");
$corpoTxt = 'Teste envio relatórios são';
$corpoHtml= '<html><body>Versão HTML do texto</body></html>';
我试过了:
$corpoTxt=$mime->encodeHeader("corpo", $corpoTxt, "utf-8", "quoted-printable");
$corpoHtml=$mime->encodeHeader("corpohtmls", $corpoHtml, "utf-8", "quoted-printable");
但它没有用,我得到了:
Versão HTML do texto
提前感谢您的帮助!
答案 0 :(得分:0)
在调用$ mine-headers()函数之前尝试包含这些行。
# Ensure EML is UTF-8 compliant
$mimeparams["debug"] = "True";
$mimeparams['text_encoding'] = "8bit";
$mimeparams['text_charset'] = "UTF-8";
$mimeparams['html_charset'] = "UTF-8";
$mimeparams['head_charset'] = "UTF-8";
$mime->get($mimeparams);
这将确保您的UTF-8字符在EML中正确显示。最后,像这样保存TXT和HTML正文:
$mime->setTXTBody($corpoTxt);
$mime->setHTMLBody($corpoHtml);
那应该有用。如需更多帮助,请查看: