Added alternative to mb_convert_encoding in Emogrifier, closes #7378
This commit is contained in:
parent
a17bd25c96
commit
455b27e125
|
@ -352,7 +352,11 @@ class Emogrifier {
|
|||
$this->copyCssWithMediaToStyleNode($cssParts, $xmlDocument);
|
||||
|
||||
if ($this->preserveEncoding) {
|
||||
return mb_convert_encoding($xmlDocument->saveHTML(), self::ENCODING, 'HTML-ENTITIES');
|
||||
if ( function_exists( 'mb_convert_encoding' ) ) {
|
||||
return mb_convert_encoding( $xmlDocument->saveHTML(), self::ENCODING, 'HTML-ENTITIES' );
|
||||
} else {
|
||||
return htmlspecialchars_decode( utf8_encode( html_entity_decode( $xmlDocument->saveHTML(), ENT_COMPAT, self::ENCODING ) ) );
|
||||
}
|
||||
} else {
|
||||
return $xmlDocument->saveHTML();
|
||||
}
|
||||
|
@ -536,7 +540,11 @@ class Emogrifier {
|
|||
$bodyWithoutUnprocessableTags = $this->html;
|
||||
}
|
||||
|
||||
return mb_convert_encoding($bodyWithoutUnprocessableTags, 'HTML-ENTITIES', self::ENCODING);
|
||||
if ( function_exists( 'mb_convert_encoding' ) ) {
|
||||
return mb_convert_encoding( $bodyWithoutUnprocessableTags, 'HTML-ENTITIES', self::ENCODING );
|
||||
} else {
|
||||
return htmlspecialchars_decode( utf8_decode( htmlentities( $bodyWithoutUnprocessableTags, ENT_COMPAT, self::ENCODING, false ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue