Joomla UTF-8 encoding fails on opening the mail
joomla, joomla1.5, php, phpmailer, unicode
Solution
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:
Missing Mime-Version
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.
Showing Subject with Special Characters
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);
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.
Problem
I have a strange issue with encoding, described as follows: 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 ``` should be ``` Uw contact met Meeùs ``` i have already used the encoding. `$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"); ``` 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.