Forum


Replies: 5   Views: 3852
Special characters not shown from html to docx
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 KRav  · 22-06-2016 - 12:50

Hi there, 

I try to insert special characters into 

oDocx->embedHTML

The problen is, that the given html string has this " größe, Köln " etc.

I docx it shows something like this "ö" for "ö"

 

I try this, without success:

$oPurify = new CHtmlPurifier();

$sIntroText = $this->aData['intro']['text'];
$aIntroText = explode('{{tabelle}}', $sIntroText);
$this->oDocx->addBreak(array('type' => 'page'));

$this->oDocx->embedHTML($oPurify->purify($aIntroText[1]));

What I'm doing wrong?

Posted by admin  · 22-06-2016 - 14:01

Hello,

Please check that PHP Tidy is installed and enabled on your server.

Regards.

Posted by KRav  · 24-06-2016 - 13:51

It's not poosible to install tidy up.

Posted by admin  · 24-06-2016 - 14:31

Hello,

Which license and version of phpdocx are you using?

Tidy is needed to work with special characters.

Regards.

Posted by KRav  · 28-06-2016 - 21:05

I'm using the pro version. And use docx in YII.

I disabled the utf-8 in the config file meanwhile without success.

I have a clean html string like that: '<p> ÜÄÖ</p>'

$this->oDocx->embedHTML('<p> ÜÄÖ</p>');

And I get this "Ä ÃÂœ Ä Ã" this wired characters with boxes..

From my point of view the is clean - do I have to convert this charcters before? What would tidy do?

 

Posted by admin  · 29-06-2016 - 06:34

Hello,

Please install and enable PHP Tidy extension to fix it. If you can't install Tidy, that is the recommended way, you'll need to edit the file lib/dompdfParser/include/parserhtml.cls.php and change the method _load_html; in this method you can remove the library htmlawed (used when Tidy is not available) and use your custom library to fix and repair HTML (or even remove htmlawed is the HTML and its CSS is correct).

But again, please install Tidy to work with HTML.

Regards.