From 67e181fd4f85b3002fcdf48a8ebabe0c4ce9ed24 Mon Sep 17 00:00:00 2001 From: Andreas Schamberger Date: Thu, 5 Jan 2012 13:58:35 +0100 Subject: [PATCH] fixed mime to handle binary data correctly --- src/BeSimple/SoapCommon/Mime/Parser.php | 4 ++-- src/BeSimple/SoapCommon/Mime/Part.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/BeSimple/SoapCommon/Mime/Parser.php b/src/BeSimple/SoapCommon/Mime/Parser.php index 5ca618f..c4a8c27 100644 --- a/src/BeSimple/SoapCommon/Mime/Parser.php +++ b/src/BeSimple/SoapCommon/Mime/Parser.php @@ -85,7 +85,7 @@ class Parser if (strlen($line) > 0 && $line[0] == "-") { if (strcmp(trim($line), '--' . $boundary) === 0) { if ($currentPart instanceof Part) { - $content = iconv_substr($content, 0, -2, 'utf-8'); + $content = substr($content, 0, -2); self::decodeContent($currentPart, $content); // check if there is a start parameter given, if not set first part $isMain = (is_null($start) || $start == $currentPart->getHeader('Content-ID')) ? true : false; @@ -99,7 +99,7 @@ class Parser $inHeader = true; $content = ''; } elseif (strcmp(trim($line), '--' . $boundary . '--') === 0) { - $content = iconv_substr($content, 0, -2, 'utf-8'); + $content = substr($content, 0, -2); self::decodeContent($currentPart, $content); // check if there is a start parameter given, if not set first part $isMain = (is_null($start) || $start == $currentPart->getHeader('Content-ID')) ? true : false; diff --git a/src/BeSimple/SoapCommon/Mime/Part.php b/src/BeSimple/SoapCommon/Mime/Part.php index 48aa438..714f137 100644 --- a/src/BeSimple/SoapCommon/Mime/Part.php +++ b/src/BeSimple/SoapCommon/Mime/Part.php @@ -149,6 +149,7 @@ class Part extends PartHeader case self::ENCODING_QUOTED_PRINTABLE: return quoted_printable_encode($content); case self::ENCODING_BINARY: + return $content; case self::ENCODING_SEVEN_BIT: case self::ENCODING_EIGHT_BIT: default: