Question

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

Était-ce utile?

La solution

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.

Autres conseils

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
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top