我正在使用phpmailer类发送电子邮件。现在,我来自欧洲,所以我们使用了重音字符。。。但是它们在我的php脚本中处理得很糟糕,我不知道为什么。。我多次尝试从utf-8更改为iso-8859-1,反之亦然,从我的html表单script.php和class.phpmailer.php都没有成功。(class.phpmailer.php默认为iso-8859-1)
//My form.html
...
<form action="script.php" name="contatti" method="POST" accept-charset="ISO-8859-1">
</form>
...
//My script.php
...
require "phpmailer/class.phpmailer.php";
$messaggio = new PHPmailer();
$messaggio->CharSet = "ISO-8859-1";
...
//class.phpmailer.php
...
public $CharSet = 'utf-8';
...
对不起我的英语。谢谢
所有地方的编码都应该一致。所以让我们坚持使用utf-8。首先,请检查您的网站是否为UTF-8编码。你应该在你的HTML:中找到这样的东西
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
然后把你的"ISO-8859-1"换成utf-8,看看你现在有什么。