When pdf files are generated from html, diacritics ar not correctly encoded. This patch forces encoding to utf-8
Created attachment 13879 [details] [review] Bug 9208 : Add utf-8 encoding when generating pdf letters from html files.
Created attachment 13935 [details] [review] Bug 9208 : Add utf-8 encoding when generating pdf letters from html files. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
QA Comment: Trivial change. Did not test it; requires specific Python library. The added encoding parameter seems to be in line with xhtml2pdf specs. Will not harm anyone :) Passed QA
Could you please provide an example of when diacritics are not coded correctly? As far as I can tell, encoding is automatically correct before the patch.
Marking failed QA until I have an answer about how to reproduce.
Created attachment 28849 [details] [review] Bug 9208 : Fix encoding of overdue letters When overdue letters templates contain symbol like euro, the conversion between html to pdf results in wrong encoding of special characters. Adding explicit utf8 encoding at the beginning of html file resolves this problem. This is already done for hold notices.
I replace the initial patch with this new one that is compliant with what already exists for holds notices. To test : * Write an overdue letter with some symbol like € (euro) for example) * make sure you've got one borrower with overdue that will trigger overdue notice * run misc/cronjobs/overdue_notices.pl -html and misc/cronjobs/printoverdues.sh to convert html file into pdf Without patch, all non unicode charaters are wrong encoded. With the patch, encoding is fine
Created attachment 28866 [details] [review] Bug 9208 : Fix encoding of overdue letters When overdue letters templates contain symbol like euro, the conversion between html to pdf results in wrong encoding of special characters. Adding explicit utf8 encoding at the beginning of html file resolves this problem. This is already done for hold notices.
Fixing some typo in the patch
Created attachment 30810 [details] [review] [SIGNED-OFF] Bug 9208 : Fix encoding of overdue letters When overdue letters templates contain symbol like euro, the conversion between html to pdf results in wrong encoding of special characters. Adding explicit utf8 encoding at the beginning of html file resolves this problem. This is already done for hold notices. Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
I am sorry, but I can't get this to work correctly. When running the overdue_notices.pl -html ./ I ended up with an almost empty html file, although I have pending ODUE notices of the type print in my message_queue table and I have a print template defined in my notices. <html> <head> <meta charset="utf-8" /> <style type='text/css'> pre {page-break-after: always;} pre {white-space: pre-wrap;} pre {white-space: -moz-pre-wrap;} pre {white-space: -o-pre-wrap;} pre {word-wrap: break-work;} </style> </head> <body> </body> </html> ~ Also, I can't create a PDF easily, because the required PISA version is not available via apt-get for Ubuntu: **************************************************** IMPORT ERROR! Reportlab Version 2.1+ is needed! **************************************************** The following Python packages are required for PISA: - Reportlab Toolkit >= 2.2 <http://www.reportlab.org/> - HTML5lib >= 0.11.1 <http://code.google.com/p/html5lib/> Optional packages: - pyPDF <http://pybrary.net/pyPdf/> - PIL <http://www.pythonware.com/products/pil/>
I think there is an overlap of this patch and bug 8687 in both fixing the encoding.
Hi Sophie, I think this problem is also fixed by 8687 - please reopen if I am mistaken. *** This bug has been marked as a duplicate of bug 8687 ***