fixed mime to handle binary data correctly

This commit is contained in:
Andreas Schamberger 2012-01-05 13:58:35 +01:00
parent 22665b50ae
commit 67e181fd4f
2 changed files with 3 additions and 2 deletions

View File

@ -85,7 +85,7 @@ class Parser
if (strlen($line) > 0 && $line[0] == "-") { if (strlen($line) > 0 && $line[0] == "-") {
if (strcmp(trim($line), '--' . $boundary) === 0) { if (strcmp(trim($line), '--' . $boundary) === 0) {
if ($currentPart instanceof Part) { if ($currentPart instanceof Part) {
$content = iconv_substr($content, 0, -2, 'utf-8'); $content = substr($content, 0, -2);
self::decodeContent($currentPart, $content); self::decodeContent($currentPart, $content);
// check if there is a start parameter given, if not set first part // check if there is a start parameter given, if not set first part
$isMain = (is_null($start) || $start == $currentPart->getHeader('Content-ID')) ? true : false; $isMain = (is_null($start) || $start == $currentPart->getHeader('Content-ID')) ? true : false;
@ -99,7 +99,7 @@ class Parser
$inHeader = true; $inHeader = true;
$content = ''; $content = '';
} elseif (strcmp(trim($line), '--' . $boundary . '--') === 0) { } elseif (strcmp(trim($line), '--' . $boundary . '--') === 0) {
$content = iconv_substr($content, 0, -2, 'utf-8'); $content = substr($content, 0, -2);
self::decodeContent($currentPart, $content); self::decodeContent($currentPart, $content);
// check if there is a start parameter given, if not set first part // check if there is a start parameter given, if not set first part
$isMain = (is_null($start) || $start == $currentPart->getHeader('Content-ID')) ? true : false; $isMain = (is_null($start) || $start == $currentPart->getHeader('Content-ID')) ? true : false;

View File

@ -149,6 +149,7 @@ class Part extends PartHeader
case self::ENCODING_QUOTED_PRINTABLE: case self::ENCODING_QUOTED_PRINTABLE:
return quoted_printable_encode($content); return quoted_printable_encode($content);
case self::ENCODING_BINARY: case self::ENCODING_BINARY:
return $content;
case self::ENCODING_SEVEN_BIT: case self::ENCODING_SEVEN_BIT:
case self::ENCODING_EIGHT_BIT: case self::ENCODING_EIGHT_BIT:
default: default: