Joomla UTF-8 编码在打开邮件时失败
我有一个奇怪的编码问题,描述如下:
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");
在本地主机中它工作正常,但在网络服务器中它不能正常工作.在网络服务器中,编码也默认设置为 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.
相关文章