Replies: 4   Views: 4421
Problem with utf-8 encoded text when using embedhtml
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 vecano  · 05-12-2013 - 00:44

Cretain characters outside the ASCII set are incorrectly set on docx file when using embedHTML() using a utf-8 encoded HTML source.

I've also tried using setEncodeUTF8 without success.

What do I need to do to create a docx file that has correct encoding when using embedHTML and the text is utf-8 encoded?

Posted by jorgelj  · 05-12-2013 - 11:58


Please try setting encode_to_UTF8 option to true in config/phpdocxconfig.ini; and avoid using setEncodeUTF8. And post the result.


Posted by vecano  · 05-12-2013 - 23:38

I'm using a modified version of the file: "examples/easy/SetLanguage.php" except that I changed addText to embedHTML as:

// ---------------------------------------

require_once '../../classes/';

$docx=new CreateDocx();


$docx->embedHTML('Este documento tiene el español de España como idioma por defecto (The default document language has been set to Spanish-Spain).');


// ---------------------------------------

And I get this file:

I'm using Ubuntu 12.04 LTS, PHP 5.3.10

Posted by jorgelj  · 07-12-2013 - 20:33


Please check this post: