Skip to content

Email body truncated on special character when incoming email charset is not UTF-8 #16

@Vzzbux

Description

@Vzzbux

Incoming emails that have a charset of e.g. iso-8859-1 and include a special character e.g. £ (=A3) are truncated at that point when they're inserted into the database (and therefore when they're sent out on a campaign).

Not sure if this is technically a problem with the mimeDecode.php library or submitByMailPlugin, but I believe it's a problem because of the charset of the MySql database that phplist uses (UTF-8 by default). See this stackoverflow question.

I believe I've managed to fix it within submitByMailPlugin. My last pull request was ignored because the developer no longer supports this plugin, so I'll just include the patch here:

Within submitByMailPlugin.php, alter the following block within the parseAPart() function (roughly line 806):

 if ($c2 == 'plain') {
		 $this->textmsg .= $apart->body;
 } else
		 $this->htmlmsg .= $apart->body;

to the following:

 $charset = $this->std($apart->ctype_parameters["charset"]);
 $body = $apart->body;
 if (is_string($charset) && strtolower($charset) !== "utf8") $body = iconv($charset, "UTF8", $body);
 if ($c2 == 'plain') {
		 $this->textmsg .= $body;
 } else {
		 $this->htmlmsg .= $body;
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions