forked from extern/egroupware
Fix mail integration fails for mails with having not encoded ampersands on their html content
This commit is contained in:
parent
aaf22ceb77
commit
d3b75e0a5e
@ -491,13 +491,14 @@ class Html
|
|||||||
{
|
{
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
// try to cleanup not encoded ampersands used possibily in urls
|
||||||
|
$html = preg_replace('/&(?!#?[a-zA-Z0-9]+;)/', '&', $html);
|
||||||
|
|
||||||
$dom = new \DOMDocument('1.0','UTF-8');
|
$dom = new \DOMDocument('1.0','UTF-8');
|
||||||
$dom->loadHTML(
|
if(!$dom->loadHTML(
|
||||||
'<?xml encoding="UTF-8">'. Api\Translation::convert($html,false, 'utf8'),
|
'<?xml encoding="UTF-8">'. Api\Translation::convert($html,preg_match('/<meta[^>]+content="[^>"]+charset=([^;"]+)/i', $html, $matches) ? $matches[1] : false, 'utf8'),
|
||||||
LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD | LIBXML_NOBLANKS
|
LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD | LIBXML_NOBLANKS
|
||||||
);
|
))
|
||||||
if(!$dom)
|
|
||||||
{
|
{
|
||||||
// Failed to parse
|
// Failed to parse
|
||||||
return $html;
|
return $html;
|
||||||
|
Loading…
Reference in New Issue
Block a user