Post by jonghwa » Mon Jan 28, 2013 2:58 pm

Hi,

The default language of my cart is not English, but Korean, and the cart version is 1.5.4.1.

If the order is complete, the cart sends an email by "system/library/mail.php".

If the protocol is "mail", it encodes the subject correctly as follows:

Code: Select all

                if ($this->protocol == 'mail') {
                        ini_set('sendmail_from', $this->from);

                        if ($this->parameter) {
                                mail($to, '=?UTF-8?B?' . base64_encode($this->subject) . '?=', $message, $header, $this->parameter);
                        } else {
                                mail($to, '=?UTF-8?B?' . base64_encode($this->subject) . '?=', $message, $header);
                        }
However, it does not encode the subject if the protocol is "smtp" (not "mail").

Code: Select all

                if ($this->protocol != 'mail') {
                        $header .= 'To: ' . $to . $this->newline;
                        $header .= 'Subject: ' . $this->subject . $this->newline;
                }
I believe that most of non-English mail clients will try to decode the subject in their own language character set if not specified. Of course, it shows broken title.

I changed the line:

Code: Select all

                        $header .= 'Subject: ' . $this->subject . $this->newline;
into

Code: Select all

                        $header .= 'Subject: ' . '=?UTF-8?B?' . base64_encode($this->subject) . '?=' . $this->newline;
It works fine.

Please, consider the core code update. Thank you.

핀코인 (http://pincoin.co.kr)

extensions by pincoin


User avatar
New member

Posts

Joined
Thu Oct 25, 2012 12:29 pm
Location - Seoul

Post by iLef » Mon Mar 25, 2013 5:33 am

Thank you veeeeeeeeeeeeeeeery much my friend!

It works great!

Good Job!

Greetings From Greece!

Lefteris._

Newbie

Posts

Joined
Fri Mar 15, 2013 7:44 pm

Post by butte » Mon Mar 25, 2013 8:05 am

More generally, customary character sets are broadly regional, such as western ISO-8859-1, unicode UTF-8, and several others. Forcing everyone to UTF-8 is probably not the best change to core. Either an installation option (also probably not best) or an admin panel setting (probably the most likely acceptable to most people) for character sets would allow people to set it as they wish. An additional wrinkle is that browsers provide a setting for Character Encoding (however worded), and that can override a website, while in your own region most users may already have their browsers preset to favor UTF-8. Hard-recoding the line to a preference, as you did to UTF-8, remains an option that anyone can use.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by tango@gxm.dk » Fri Jan 10, 2014 8:04 am

Thank YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Did this small vQMod to make the change without changing the original file.

Regards
Thomas

Attachments

Fix e-mail subject encode problem


Newbie

Posts

Joined
Mon Dec 31, 2012 9:11 pm

Post by adriankoooo » Fri Feb 28, 2014 5:08 am

Yesss! Thank you. :)

Active Member

Posts

Joined
Thu Mar 03, 2011 6:52 am


Post by p3nsy » Sun Jan 31, 2016 6:35 am

Hello! I'm having this same problem but the other way around, I get the random UTF-8 email subjects when I'm using protocol 'mail' and I just don't find any source on how to fix it, so far your solution is the most similar but it didn't fix it when I tried :(

Newbie

Posts

Joined
Fri Jan 29, 2016 3:19 am
Who is online

Users browsing this forum: No registered users and 7 guests