functions.inc.php - imap_8bit and UTF-8

Discussion corner for Developers of Serendipity.
Post Reply
mivi
Posts: 3
Joined: Mon May 21, 2012 3:26 pm

functions.inc.php - imap_8bit and UTF-8

Post by mivi » Fri Dec 12, 2014 12:29 pm

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

User avatar
garvinhicking
Core Developer
Posts: 30014
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

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

Post by garvinhicking » Fri Dec 12, 2014 2:59 pm

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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

mivi
Posts: 3
Joined: Mon May 21, 2012 3:26 pm

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

Post by mivi » Fri Dec 12, 2014 3:18 pm

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

User avatar
garvinhicking
Core Developer
Posts: 30014
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

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

Post by garvinhicking » Fri Dec 12, 2014 3:31 pm

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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

bernd_d
Regular
Posts: 466
Joined: Thu Jun 03, 2010 9:28 am
Contact:

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

Post by bernd_d » Sat Dec 27, 2014 9:06 pm

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 2673 times
I already had this problem a while ago with another person, but i can't find the thread anymore currently.

Post Reply