Forum


Replies: 1   Views: 1947
Mb_convert_encoding message with the demo
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by naresh  · 25-01-2021 - 09:46

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

Posted by admin  · 25-01-2021 - 10:11

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.