diff --git a/include/class.format.php b/include/class.format.php index 10859d15a1885a2775c1c296b1a52b017269fc7a..ce39d5fbdbaaf4cf84028ca4f39276ea6704df2d 100644 --- a/include/class.format.php +++ b/include/class.format.php @@ -45,6 +45,9 @@ class Format { if($charset && in_array(strtolower(trim($charset)), array('default','x-user-defined','iso'))) $charset = 'ISO-8859-1'; + + if (strcasecmp($charset, $encoding) === 0) + return $text; $original = $text; if(function_exists('iconv') && $charset) diff --git a/include/class.mailparse.php b/include/class.mailparse.php index 3347451de99a1aa3f1b116b2098de60b2c3e0864..b1f57a6f50281d71658e7e868e62029ef8787d40 100644 --- a/include/class.mailparse.php +++ b/include/class.mailparse.php @@ -202,9 +202,14 @@ class Mail_Parse { $file=array( 'name' => $filename, 'type' => strtolower($part->ctype_primary.'/'.$part->ctype_secondary), - 'data' => $this->mime_encode($part->body, $part->ctype_parameters['charset']) ); + if ($part->ctype_parameters['charset']) + $file['data'] = $this->mime_encode($part->body, + $part->ctype_parameters['charset']); + else + $file['data'] = $part->body; + if(!$this->decode_bodies && $part->headers['content-transfer-encoding']) $file['encoding'] = $part->headers['content-transfer-encoding'];