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

Was it helpful?

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.

OTHER TIPS

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top