File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -62,8 +62,15 @@ public function getHtmlContent()
6262
6363 $ this ->htmlContent = new DOMDocument ();
6464
65- if (mb_detect_encoding ($ content ) === 'UTF-8 ' ) {
65+ if (mb_detect_encoding ($ content, ' UTF-8 ' , true ) === 'UTF-8 ' ) {
6666 $ content = mb_convert_encoding ($ content , 'HTML-ENTITIES ' , 'UTF-8 ' );
67+ $ content = preg_replace (
68+ '/<head[^>]*>/ ' ,
69+ '<head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> ' ,
70+ $ content
71+ );
72+ } elseif (mb_detect_encoding ($ content , 'ISO-8859-1 ' , true ) === 'ISO-8859-1 ' ) {
73+ $ content = mb_convert_encoding ($ content , 'HTML-ENTITIES ' , 'ISO-8859-1 ' );
6774 $ content = preg_replace ('/<head[^>]*>/ ' , '<head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> ' , $ content );
6875 }
6976
You can’t perform that action at this time.
0 commit comments