Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Email class sometimes breaks multibyte subject #1498

takyana opened this Issue · 3 comments

2 participants


The subject function of Email class sometimes breaks multibyte subject by splitting it at middle of a single multibyte character.

To regenerate this issue, placing the following code in the controller folder (file encoding should be UTF-8).

class Emailtest extends CI_Controller {
    public function index()

Then access to it and you will see the following result.

array(1) { ["Subject"]=> string(134) "=?utf-8?Q?=e3=81=93=e3=82=8c=e3=81=af=e6=97=a5=e6=9c=ac=e8=aa=9e=e3=81?= =?utf-8?Q?=ae=e3=83=86=e3=82=b9=e3=83=88=e3=81=a7=e3=81=99?=" } 

3 bytes "=e3=81=ae" around the second "=?utf-8?Q?" string, should not be splitted since these 3 byte combination means a single Japanese character.

As long as I tested, Thunderbird and Apple Mail fail to display this encoded subject.

The easiest fix is to use mb_encode_mimeheader function instead of _prep_q_encoding.
According to the PHP manual, mb_encode_mimeheader folds the line into 74 characters.


See #1409.

@narfbg narfbg closed this

Before posting this issue, I read #1409.
#1409 seems different case, which is about how to correctly encode single line subject.


The "fix" might not be the same, but otherwise it's no different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.