diff --git a/api/src/Mail/Html.php b/api/src/Mail/Html.php index c720ad9909..491c4b4379 100644 --- a/api/src/Mail/Html.php +++ b/api/src/Mail/Html.php @@ -284,11 +284,12 @@ class Html // replace fieldset with legend used for original message header $_html = preg_replace_callback('#]*>\s*(.*?)\s*(.*?)\s*#sm', - static function($matches) + static function($matches) use ($displayCharset) { - $len_legend = strlen($legend = $matches[1]); + $len_legend = strlen($legend = html_entity_decode($matches[1], ENT_QUOTES|ENT_SUBSTITUTE, $displayCharset)); $content = preg_replace('/<([^@> ]+@[^> ]+)>/', '#lower#than#$1#greater#than#', $matches[2]); - return "
".str_repeat('-', (64-$len_legend-2)>>1).' '.$legend.' '.str_repeat('-', (64-$len_legend-2+1)>>1)."
". + return "
".str_repeat('-', min(0, (64-$len_legend-2)>>1)).' '.$legend.' '. + str_repeat('-', min(0, (64-$len_legend-2+1)>>1))."
". $content."
".str_repeat('-', 64)."
"; }, $_html);