OpenTBS and Special Characters (PHP)
-
18-06-2021 - |
Вопрос
I'm using OpenTBS to modify word templates from PHP. Basically I need to update strings in a word document from values that I have in a MySQL database. It is working well, however when I have special characters such as é, à, ô, it outputs a sequence of weird caracters.
For example the é gives me é.
Anybody knows how to fix that?
Thanks
Решение
By default, OpenTBS assumes that the data to be merged are Ascii encoded. It the data is UTF-8 encoded, then you have to specify it when loading the template.
Example:
$TBS->LoadTemplate('document.docx', OPENTBS_ALREADY_UTF8);
You also have to check that your PHP script is UTF-8 encoded.
More details are given in the manual.
Другие советы
Its a character encoding issue. Change your page to utf-8
See http://php.net/manual/en/function.header.php
Content-Type: text/plain; charset=utf-8
Не связан с StackOverflow