今天,Wordpress官方发布了2.6.2版。没有跑去Trac看代码变动地方,直接就将程序下载了。照例是修改几处源代码以及将akismet删掉。然后上传升级。一切都很顺利。从更新上看,似乎2.6.2没有多大变化,运行upgrade.php,并未提示更新数据库。看来此版本的升级无涉及数据库方面的更改。 

在朋友站点逛了圈,发现还是有很多WP站点发送的中文邮件标题容易出现乱码情况。索性将其解决方法放上来。此方法从2.2起至当前的2.6.2均有效。建议网友根据文中代码,自行修改源代码。

具体做法:

用文本编辑器打开wp-includes/class-phpmailer.php,在EncodeHeader函数内找到下列代码,大概在1165-1175行左右。

   1: if (strlen($str)/3 < $x) {
   2:     $encoding = 'B';
   3:     $encoded = base64_encode($str);
   4:     $maxlen -= $maxlen % 4;
   5:     $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
   6: } else {
   7:     $encoding = 'Q';
   8:     $encoded = $this->EncodeQ($str, $position);
   9:     $encoded = $this->WrapText($encoded, $maxlen, true);
  10:     $encoded = str_replace("=".$this->LE, "\n", trim($encoded));
  11: }

将上述中的第4,5和9行前面加上注释符号"//",使之失效。如下: 

   1: if (strlen($str)/3 < $x) {
   2:     $encoding = 'B';
   3:     $encoded = base64_encode($str);
   4:     //$maxlen -= $maxlen % 4;
   5:     //$encoded = trim(chunk_split($encoded, $maxlen, "\n"));
   6: } else {
   7:     $encoding = 'Q';
   8:     $encoded = $this->EncodeQ($str, $position);
   9:     //$encoded = $this->WrapText($encoded, $maxlen, true);
  10:     $encoded = str_replace("=".$this->LE, "\n", trim($encoded));
  11: }

保存退出,将修改后的class-phpmailer.php文件上传到服务器上。

注:此法并不是我原创,乃是N久前在网上搜索到的。原出处也已忘记,故无法在此将出处标出。敬请见谅。

 

Feed Me


转载文章请注明转载自:ThinkAgain - Let's Blog!

引用地址:http://www.thinkagain.cn/archives/994.html