Commit d0167f10 authored by Andreas Brodowski's avatar Andreas Brodowski

ZP-1230 windows-phone-8.1-unable-to-sync. Released under the Affero GNU...

ZP-1230 windows-phone-8.1-unable-to-sync. Released under the Affero GNU General Public License (AGPL) version 3.
Fixed as described in Jira.
parent 5f3ef743
......@@ -2473,16 +2473,20 @@ class MAPIProvider {
elseif (isset($message->internetcpid) && $bpReturnType == SYNC_BODYPREFERENCE_HTML) {
// if PR_HTML is UTF-8 we can stream it directly, else we have to convert to UTF-8 & wrap it
if (Utils::GetCodepageCharset($message->internetcpid) == "utf-8") {
$message->asbody->data = MAPIStreamWrapper::Open($stream);
$body = $this->mapiReadStream($stream, $streamsize);
$message->asbody->data = StringStreamWrapper::Open(str_replace("\n","",str_replace("\r","",$body)));
}
else {
$body = $this->mapiReadStream($stream, $streamsize);
$message->asbody->data = StringStreamWrapper::Open(Utils::ConvertCodepageStringToUtf8($message->internetcpid, $body));
$message->asbody->data = StringStreamWrapper::Open(Utils::ConvertCodepageStringToUtf8($message->internetcpid, str_replace("\n","",str_replace("\r","",$body))));
$message->internetcpid = 65001;
}
}
else {
$message->asbody->data = MAPIStreamWrapper::Open($stream);
}
$stat = fstat($message->asbody->data);
$streamsize = $stat['size'];
$message->asbody->estimatedDataSize = $streamsize;
}
else {
......
......@@ -300,7 +300,7 @@ class Streamer implements Serializable {
if ($encoder->getMultipart() && isset($map[self::STREAMER_PROP]) && $map[self::STREAMER_PROP] == self::STREAMER_TYPE_MULTIPART) {
$encoder->addBodypartStream($this->{$map[self::STREAMER_VAR]});
$encoder->startTag(SYNC_ITEMOPERATIONS_PART);
$encoder->content($encoder->getBodypartsCount());
$encoder->content($encoder->getBodypartsCount()+1);
$encoder->endTag();
continue;
}
......
......@@ -41,6 +41,7 @@ class SyncBaseBody extends SyncObject {
SYNC_AIRSYNCBASE_TRUNCATED => array (self::STREAMER_VAR => "truncated"),
SYNC_AIRSYNCBASE_DATA => array (self::STREAMER_VAR => "data",
self::STREAMER_TYPE => self::STREAMER_TYPE_STREAM_ASPLAIN,
self::STREAMER_PROP => self::STREAMER_TYPE_MULTIPART,
self::STREAMER_RONOTIFY => true,
self::STREAMER_PRIVATE => true), // just remove the body when stripping private
);
......
......@@ -788,7 +788,7 @@ class Utils {
public static function ConvertCodepageStringToUtf8($codepage, $string) {
if (function_exists("iconv")) {
$charset = self::GetCodepageCharset($codepage);
return iconv($charset, "utf-8", $string);
return iconv($charset, "utf-8", str_replace($charset,"utf-8",$string));
}
else
ZLog::Write(LOGLEVEL_WARN, "Utils::ConvertCodepageStringToUtf8() 'iconv' is not available. Charset conversion skipped.");
......
......@@ -486,6 +486,7 @@ class WBXMLEncoder extends WBXMLDefs {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("WBXMLEncoder->processMultipart() with %d parts to be processed", $this->getBodypartsCount()));
$len = ob_get_length();
$buffer = ob_get_clean();
ob_start();
$nrBodyparts = $this->getBodypartsCount();
$blockstart = (($nrBodyparts + 1) * 2) * 4 + 4;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment