From f208af8dfba479f5e7a89a5c6d4a00c711cdfc9c Mon Sep 17 00:00:00 2001 From: Alexandros Sigalas Date: Mon, 1 Apr 2019 09:15:09 +0300 Subject: [PATCH] Use charset from mail part --- api/src/Mail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/Mail.php b/api/src/Mail.php index cd0da046cf..a9df47944a 100644 --- a/api/src/Mail.php +++ b/api/src/Mail.php @@ -1698,7 +1698,7 @@ class Mail $_structure=$part; $this->fetchPartContents($uid, $_structure, false,true); $headerObject['BODYPREVIEW']=trim(str_replace(array("\r\n","\r","\n"),' ',mb_substr(Mail\Html::convertHTMLToText($_structure->getContents()),0,((int)$_fetchPreviews<300?300:$_fetchPreviews)))); - $charSet=Translation::detect_encoding($headerObject['BODYPREVIEW']); + $charSet = $part->getCharset(); // add line breaks to $bodyParts //error_log(__METHOD__.' ('.__LINE__.') '.' Charset:'.$bodyParts[$i]['charSet'].'->'.$bodyParts[$i]['body']); $headerObject['BODYPREVIEW'] = Translation::convert_jsonsafe($headerObject['BODYPREVIEW'], $charSet);