phpmailer类和重音字符

时间:2012-07-28 22:40:11

标签: php forms class character-encoding phpmailer

我正在使用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';
...

抱歉我的英文。 谢谢!

1 个答案:

答案 0 :(得分:0)

编码应该在所有地方保持一致。所以我们坚持使用utf-8。首先检查您的网站是否是UTF-8编码的。您应该在HTML中查找类似的内容:

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

然后将您的“ISO-8859-1”替换为utf-8并查看您现在拥有的内容。

相关问题