I'm using but getting � on my email. How can I fix this?
代码的某些部分:
$review = "
<table width='100%' border='0'>
<tr>
<td class='text_font' >Customer Name: $account_nam</td>
</tr>
</table>";
显示为
客户名称: 样本帐户名称
还有这个:
<td width='20%' style='border-bottom: 1px solid #CECECE;'></td>
<td>
没有价值但显示有趣的符号
答案 0 :(得分:1)
我猜你的编码是UTF-8,而邮件客户端是ISO,反之亦然。 请务必在邮件标题中发送正确的编码。
使用空白空间生成边距无论如何都不是一个好主意,为什么不将表格单元格用于字段和值:
$review = "
<table width='100%' border='0'>
<tr>
<td class='text_font' >Customer Name:</td>
<td>" . $account_name . "</td>
</tr>
</table>";
答案 1 :(得分:0)
很可能是编码问题。您正在使用的编辑器上的设置可能是以某些无法识别的编码保存文本。我使用notepad ++时遇到过类似的问题而没有考虑编码。
答案 2 :(得分:0)
您有可能从MS Word导入文本。 Word有一些时髦的字符,如有角度的引号等。
你可以在评论中使用htmlentities
作为Daryl建议,但我在过去发现你必须像这样str_replace这些字符:
$text = str_replace("“", '"', $text);
$text = str_replace("”", '"', $text);
$text = str_replace("‘", "'", $text);
$text = str_replace("’", "'", $text);
$text = str_replace("…", '...', $text);
$text = str_replace("–", '-', $text);