ZF-10710: Japanese subject garbled (mojibake) in Mac Mail, Yahoo Mail for long strings

Issue Type: Bug Created: 2010-11-18T22:05:37.000+0000 Last Updated: 2012-11-20T21:38:16.000+0000 Status: Open Fix version(s): Reporter: Michael Langford (tomiford) Assignee: None Tags: - Zend_Mail

  • Zend_Mime

Related issues: Attachments:


When using Zend_Mail with a multibyte subject over 72 characters long the _encodeHeader function calls Zend_Mime::encodeBase64Header function which then calls the Zend_Mime::encodeBase64 function.

The Zend_Mime::encodeBase64 function performs a chunk_split on the base64 encoded subject. This results in an unreadable garbled subject (known as mojibake in Japanese) in the Mac Mail application and in Yahoo Web Mail.

If the chunk_split from the is removed from the Zend_Mime::encodeBase64 function the subject is output as expected in all Mail software.

This has occurred with UTF-8 emails.


Posted by Dolf Schimmel (Freeaqingme) (freak) on 2010-12-04T14:13:30.000+0000

Can you please provide a few strings that currently fail for you? (that is, the input string, and the expected output string)

Posted by Michael Langford (tomiford) on 2010-12-06T02:52:36.000+0000

The following in the subject, the to name, from name, cc name will cause the header to become corrupted.


This just says



Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.