Joomla UTF-8编码在打开邮件时失败 [英] Joomla UTF-8 encoding fails on opening the mail
问题描述
我在编码方面遇到了一个奇怪的问题,描述如下:
I have a strange issue with encoding, described as follows:
在电子邮件主题中,ù现在显示为¹¹.电子邮件是通过php邮件功能发送的.
the ù is now shown as ù in the email subject. The email is sent through php mail function.
在查看邮箱中的电子邮件时,它可以正确显示.但是,当任何人打开电子邮件时,ù突然变为¹.
When viewing the e-mail in the mailbox, it is shown correctly. However, when anybody opens the e-mail, the ù is suddenly changed to ù.
Uw contact met Meeùs
应该是
Uw contact met Meeùs
我已经使用了编码.
$emailsubject
包含上述电子邮件主题.
$emailsubject
contains the above mentioned email subject.
$subject=$emailsubject;
$subject=$emailsubject;
$email_message=new email_message_class;
$email_message->SetEncodedEmailHeader("To",$to_address,$to_name);
$email_message->SetEncodedEmailHeader("From",$from_address,$from_name);
$email_message->SetEncodedEmailHeader("Reply-To",$reply_address,$reply_name);
$email_message->SetHeader("Sender",$from_address);
$email_message->SetEncodedHeader("Subject",$subject,"UTF-8");
在localhost中,它可以正常工作,但是在网络服务器中,它不能正常工作.在网络服务器中,默认情况下还将编码设置为utf-8.
In localhost it is working properly, but in the webserver it is not working properly. In webserver also encoding is set to utf-8 by default.
我做错了什么? 预先感谢.
What i am doing wrong? Thanks in advance.
推荐答案
您的代码绝对正确,没有错误,但其他方面编码失败.因为我需要消息源标头和消息来告诉您发生了什么?我还没有任何有关您以纯文本或HTML格式发送电子邮件的信息.但是通常有两个问题:
Your code is correct absolutely there is no error in it but its other things failing encoding. As I need message source headers and message to tell you exactly what is happening? I have further no information about are you sending the email as plain text or HTML. But there are generally two issue which are:
导致字符错误显示的原因是开发人员忘记将消息描述为MIME版本.如果邮件缺少Internet邮件标准所要求的"Mime-Version"标头,则Webmail将完全忽略字符集"标头,除非该邮件已存在于UTF-8字符集中,否则将使该邮件成为垃圾邮件.
Reason for showing the character wrongly is developers forget to describe the message as MIME Version. if the message is missing the "Mime-Version" header that Internet mail standards require, Webmail will ignore the "charset" header completely, garbling the message unless it's already in the UTF-8 character set.
要以utf-8编码显示主题,则必须将主题编码为:
As you want to show the subject with utf-8 encoding then you must encode the subject as:
//Setting the Language as Japan
mb_language("ja");
//Converting the string into Japan Encoding
$subject = mb_convert_encoding($subject, "ISO-2022-JP","AUTO");
//Now convert the string to MIME Header type
$subject = mb_encode_mimeheader($subject);
如果上述问题不能解决问题,请要求您发布电子邮件的RAW标头,因为这将有助于更好地解决问题.
If the above mentioned things doesn't resolve the problem then request you post the RAW Headers of the Email as it will help in better way to resolve issue.
这篇关于Joomla UTF-8编码在打开邮件时失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!