getting the below error when downoading html to word document . what could be the issue?
mb_convert_encoding(): Unable to detect character encoding in file /vendor/phpdocx/classes/DOMPDF_lib.php on line 2609
getting the below error when downoading html to word document . what could be the issue?
mb_convert_encoding(): Unable to detect character encoding in file /vendor/phpdocx/classes/DOMPDF_lib.php on line 2609
Hello,
As explained on the documentation pages, phpdocx requires adding UTF8 contents. If non UTF8 contents are added, the library tries to transform them to UTF8 using mb_ functions from PHP.
It seems your content can't be detected automatically to be transformed to UTF8 (maybe it's mixing charsets). You can convert them to UTF8 using utf8_encode from PHP before adding it:
$html_encoded = utf8_encode($html);
$docx->embedHTML($html_encoded);
Regards.