Cookbook

Working with accents and other non-ASCII UTF8 characters

phpdocx allows to add texts with accents, umlauts and other non-ASCII, special UTF8 characters. That includes either creating new documents, or when working with templates, importing HTML or converting to PDF.

The only requirement to properly add those characters is that the text strings have to be UTF-8, which means that you must use a UTF-8 editor. Eclipse for Windows doesn't use UTF-8 as default. If the data source is not UTF-8, e.g., from a DDBB in ISO-8859, you can easily convert the strings with the PHP iconv function (http://php.net/manual/en/book.iconv.php).

When importing HTML with the embedHtml method, it is necessary to install and set up the PHP Tidy extension (http://php.net/manual/en/book.tidy.php). This extension is available in any Linux distribution and in Windows and macOS web servers.