Forum


Replies: 3   Views: 3664
Utf-8 issues with addtemplatevariable and replacetemplatevariablebyhtml
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 acunnington  · 29-05-2013 - 10:02

Hello



I am having an issue with the addTemplateVariable and replaceTemplateVariableByHTML methods. When I pass them a UTF-8 encoded string, for example: "£190". It replaces in the document with "£190".



I can confirm that all the data being passed between the pages is in UTF-8 format - the data is passed to the script via JSON, and works flawlessly elsewhere, only in PHPDocX it is facing some issues. Is it an issue with the template file not being saved in a UTF-8 format? How would I fix that?



Many thanks in advance.


Posted by acunnington  · 29-05-2013 - 10:08

I've found the option to save with UTF-8 encoding in Word 2010 but it only applies to webpages generated from Word, not docx files. Therefore I continue to have this issue. Is there any way to get UTF-8 characters in to my PHPDocX template?


Posted by jorgelj  · 30-05-2013 - 09:23

Hello,



If your string is UTF8 you musn't encode it again to UTF8, because PHP fails and recode it showing wrong characters.



Please avoid encoding to UTF8 and enable this option:



encode_to_UTF8



in config/phpdocxconfig.ini file.



If you still have the issue paste the most simple script you can do with that error; or send both files to contact[.at.]phpdocx.com.



Regards.