Forum


Replies: 9   Views: 4700
Html and utf-8 on phpdocx 3.7
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 handoi912  · 16-01-2014 - 09:38






Hi,



I download PRO trial version 3.7, and  I have 1 HTML snippet containing french. But when I addHTML to create file docx, the font error.



HTML:



$docx = new CreateDocx();

$docx->setEncodeUTF8();



$html= '<p> Découverte des plus beaux Temples d’Angkor: <strong>

          <span style="font-size:33px;">My name</span></strong></p>';



ERROR:



           Découverte des plus beaux Temples d’Angkor: My name



How to fix it?







Posted by jorgelj  · 16-01-2014 - 09:44

Hello,



If the text is UTF8 you must not use setEncodeUTF8.



Regards.


Posted by handoi912  · 16-01-2014 - 09:55

[quote=jorgelj]



Hello,



If the text is UTF8 you must not use setEncodeUTF8.



Regards.



[/quote]



if i not use setEncodeUTF8, results remain unchanged :((


Posted by jorgelj  · 16-01-2014 - 10:42

Hello,



Is Tidy installed and active in your server? And the file is UTF8?



Please post the output of the check.php file.



Regards.


Posted by handoi912  · 20-01-2014 - 10:00

[quote=jorgelj]



Please post the output of the check.php file.



[/quote]



Hello,



I don't understand, I using on Localhost ( wamp server 2.4) and i don't active tidy in PHP extensions, my file is UTF-8, I sure.



My code:



require_once 'phpdocx/classes/CreateDocx.inc';

$docx = new CreateDocx();

$html= '<p> Découverte des plus beaux Temples d’Angkor: <strong>

          <span style="font-size:33px;">My name</span></strong></p>';

$docx->addHTML(array('html' => $html));

$docx->createDocx('output/hello_world');


Posted by jorgelj  · 20-01-2014 - 11:31

Hello,



In the root folder of PHPDocX there's a script named check.php to check requirements and permissions.



If your file is already UTF8 you should't use setEncodeUTF8. PHP doesn't allow to encode an UTF8 string that it's already UTF8.



Regards.


Posted by handoi912  · 23-01-2014 - 05:50

Hello jorgelj.



Did you tried test it with french? Does it work?


Posted by jorgelj  · 23-01-2014 - 11:14

Hello,



Yes we tried it using addHTML and embedHTML and both methods works fine with UTF8 characters like spanish and french accents.



Regards.


Posted by handoi912  · 05-02-2014 - 11:00

Hello



I enable XSL and Tidy extension for PHP and it worked. Thank you very much. I will buy pro vesion.