mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 00:58:55 +01:00
Merge pull request #70 from asig2016/master_fix_sneak_preview_encoding
Mail, fix sneak preview encoding
This commit is contained in:
commit
0336bc085c
@ -1698,7 +1698,12 @@ 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();
|
||||
// check if client set a wrong charset and content is utf-8 --> use utf-8
|
||||
if (strtolower($charSet) !='utf-8' && preg_match('//u', $headerObject['BODYPREVIEW']))
|
||||
{
|
||||
$charSet['charSet'] = 'UTF-8';
|
||||
}
|
||||
// add line breaks to $bodyParts
|
||||
//error_log(__METHOD__.' ('.__LINE__.') '.' Charset:'.$bodyParts[$i]['charSet'].'->'.$bodyParts[$i]['body']);
|
||||
$headerObject['BODYPREVIEW'] = Translation::convert_jsonsafe($headerObject['BODYPREVIEW'], $charSet);
|
||||
|
@ -403,7 +403,8 @@ class Html
|
||||
$_html = str_replace('#lower#than#','<',$_html);
|
||||
$_html = str_replace('#greater#than#','>',$_html);
|
||||
//error_log(__METHOD__.__LINE__.' Charset:'.$displayCharset.' -> '.$_html);
|
||||
$_html = html_entity_decode($_html, ENT_COMPAT, $displayCharset);
|
||||
$_html = Api\Translation::convert($_html, $displayCharset, 'utf-8');
|
||||
$_html = html_entity_decode($_html, ENT_COMPAT, 'utf-8');
|
||||
//error_log(__METHOD__.__LINE__.' Charset:'.$displayCharset.' After html_entity_decode: -> '.$_html);
|
||||
//self::replaceEmailAdresses($_html);
|
||||
$pos = strpos($_html, 'blockquote');
|
||||
|
Loading…
Reference in New Issue
Block a user