ADDING 1 CHECK INTO SOURCECODE...

Aug 6, 2012 at 2:00 PM

Hello!

I got some problems regarding inserting UTF-8 formatted texts into templates using function setValue.

I repaired it in file PHPWord/Template.php changing line 89 from 

$replace = utf8_encode($replace); 

to

if (mb_detect_encoding($replace, "UTF-8") != "UTF-8") $replace = utf8_encode($replace);

 

Im sure you understand why it is important... 

BR,

Andy

Aug 8, 2012 at 8:32 PM

This issue has been discussed before. I'm not sure of why text needs to go through utf8_encode() - in other words I haven't seen an example of where it might be needed.

I use PHPWord in the HTML to docx Converter project, but have removed all instances of utf8_encode() (actually replacing it with a dummy function which passes a string through unchanged) - so that version of PHPWord can handle international character sets.