Page 1 of 1

functions.inc.php - imap_8bit and UTF-8

Posted: Fri Dec 12, 2014 11:29 am
by mivi
Why the body text is encoded imap_8bit when we use utf-8?

Code: Select all

$maildata['headers'][] = 'Content-Type: text/plain; charset=' . LANG_CHARSET;
        $maildata['headers'][] = 'Auto-Submitted: auto-generated';
        if (LANG_CHARSET == 'UTF-8') {
            if (function_exists('imap_8bit')) {
                $maildata['headers'][] = 'Content-Transfer-Encoding: quoted-printable';
                $maildata['message']   = imap_8bit($maildata['message']);
            } else {
                $maildata['headers'][] = 'Content-Transfer-Encoding: base64';
                $maildata['message']   = chunk_split(base64_encode($maildata['message']));
            }
        }
Not enough to encode header and subject ?

https://github.com/s9y/Serendipity/blob ... ns.inc.php
533 Following

Re: functions.inc.php - imap_8bit and UTF-8

Posted: Fri Dec 12, 2014 1:59 pm
by garvinhicking
Hi!

Because certain MTAs behave buggy with UTF-8 content. Using this function is the most reliable display to guarantee content not being mangled by MTAs.

HTH,
Garvin

Re: functions.inc.php - imap_8bit and UTF-8

Posted: Fri Dec 12, 2014 2:18 pm
by mivi
Hi Garvin,

thanks for your explanation.

My mail client shows brakes every 76 chars because of imap_8bit (RFC 2045).

I comment out the if/else-statement and now I get a readable mail base64 encoded and I pass on the space-saving qouted-printable encoding.

I also found the german entry
http://board.s9y.org/viewtopic.php?f=10&t=18534

Greats
Michael

Re: functions.inc.php - imap_8bit and UTF-8

Posted: Fri Dec 12, 2014 2:31 pm
by garvinhicking
Hi!

Hm, ok - this is opposite to what my thoughts on this were. I'm reluctant to change this though, because I remember that everytime we patch this rather central mail sending function, it breaks at another place. :-/

Maybe for a 2.0.1 release we could at least implement a configuration directive to force sending base64. I've added this to our issue tracker on github (https://github.com/s9y/Serendipity/issues/248).

Regards,
Garvin

Re: functions.inc.php - imap_8bit and UTF-8

Posted: Sat Dec 27, 2014 8:06 pm
by bernd_d
Robert sent me a screenshot today, that he also got line breaks where normaly shouldn't be one. I use current 2.0 from todays git.
skitch.png
skitch.png (43.11 KiB) Viewed 5312 times
I already had this problem a while ago with another person, but i can't find the thread anymore currently.