Better converting from ticket thread to PDF

Assume that text in the database is encoded in UTF-8 and assume that it is HTML text and the entities should be decoded prior to display in the PDF.

Fixes #756