Forum


Replies: 4   Views: 4553
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

Hello,



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



Regards.


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/CreateDocx.inc';

$docx=new CreateDocx();

//$docx->setLanguage('es-ES');

$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).');

$docx->createDocx('../docx/example_setLanguage');

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



And I get this file: http://ge.tt/8cVW1a71/v/0?c



I'm using Ubuntu 12.04 LTS, PHP 5.3.10


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

Hello,



Please check this post:



http://www.phpdocx.com/forums/issues/embedhtml-not-working-tables?page=1



Regards.