Forum


Replies: 5   Views: 4291
Html and utf-8
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 honzakuchar  · 11-07-2011 - 11:37

Hi,

I have encoding problem with adding HTML into docx document. I'm using UTF-8 editor, so input is properly UTF-8 encoded. When I try this code:
[code]
$docx = new CreateDocx();
$docx->addText("ěščřžýáíéé");
$docx->createDocx("test");
[/code]
Text is [i]properly[/i] encoded. But when I try this example:
[code]
$docx = new CreateDocx();
$docx->addHTML("<b>ěščřžý</b>áíéé");
$docx->createDocx("test");
[/code]
It is non-properly encoded like on this image:
[img]http://projekty.mujserver.net/Bugreports/PHPDocx/WordScreenshot1.png[/img]

So question is simple: [b]How to set encoding to UTF-8 in "word/html"?[/b]

PS: Temporary workaround:
[code]
$docx = new CreateDocx();
$docx->addHTML(iconv("UTF-8","Windows-1250","<b>ěščřžý</b>áíéé"));
$docx->createDocx("test");
[/code]

------------
Using PHP 5.3.1, PHPDOCX v2.3