Cookbook

Working with accents and other non-ASCII UTF8 characters

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

The requirements to add those characters properly are that text strings have to be UTF-8, which means that you must use a UTF-8 editor, and the PHP mbstring extension must be installed and enabled. 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 addHtml method, it is necessary to install and set up the PHP Tidy extension (http://php.net/manual/en/book.tidy.php) and the PHP mbstring extension. These extensions are available in any Linux, Windows and macOS servers.