Forum


Replies: 5   Views: 3580
™ symbol crash
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 kpholland  · 04-03-2016 - 11:00

If i put a ™ symbol in our array and then in the AddTable and then in the replaceVariableByWordFragment then phpdocx software crashes...

$wf = new WordFragment($docx, 'document');
$wf->addTable($Array_Table_Value, $paramsTable);
$docx->replaceVariableByWordFragment(array('Array_Table_Value' => $wf), array('type' => 'block'));

Posted by admin  · 07-03-2016 - 08:05

Hello,

We have done some tests and everything seem working fine. If we run this code:

<?php

require_once 'classes/CreateDocx.inc';

$docx = new CreateDocxFromTemplate('TemplateWordFragment_1.docx');

$wf = new WordFragment($docx, 'document');

$valuesTable = array(
    array(
        'AAA',
        'BBB',
    ),
    array(
        'Text',
        'Text: ™ More text'
    ),

);

$paramsTable = array(
    'border' => 'single',
    'tableAlign' => 'center',
    'borderWidth' => 10,
    'borderColor' => 'B70000',
    'textProperties' => array('bold' => true),
);

$wf->addTable($valuesTable, $paramsTable);

$docx->replaceVariableByWordFragment(array('WORDFRAGMENT' => $wf), array('type' => 'block'));

$docx->createDocx('output');

That includes a ™ symbol, phpdocx outputs a DOCX without error and this document can be opened perfectly with MS Word.

Please run this simple sample and check if your file has UTF8 encoding. If you still have this issue please send to contact[at]phpdocx.com a whole script (the simplest script that illustrate the issue without doing external connections such as databases or web services) and the DOCX document you get after running the PHP code.

Regards.

 

Posted by kpholland  · 07-03-2016 - 13:59

The array that i'am using looks like this?

Array (

[2] => Array ( [RAS_NAAM] => Cupido™ Compacto )

[3] => Array ( [RAS_NAAM] => Cupido™ Compacto )

[4] => Array ( [RAS_NAAM] => Cupido™ Compacto )

[5] => Array ( [RAS_NAAM] => Grando Cupido™ ) )

Posted by admin  · 07-03-2016 - 15:18

Hello,

All tests we have done return a correct DOCX.

As requested previously, please check you're using an UTF8 editor and if you still get this issue please send to contact[at]phpdocx.com the simplest script that illustrate the issue without doing external connections such as databases or web services and the DOCX document you get after running the PHP code.

Regards.

Posted by kpholland  · 17-03-2016 - 10:18

If i add this code below (when i gerenate the word file) the file doesn't crash :)

$sql='SET NAMES utf8';
$res = mysql_query($sql);

Posted by admin  · 17-03-2016 - 12:18

Hello,

MySQL must be returning non UTF8 strings by default. You can set UTF8 or encode the strings with PHP.

Regards.