Bug 9208 - overdue letters (pdf) are not correctly encoded
Summary: overdue letters (pdf) are not correctly encoded
Status: RESOLVED DUPLICATE of bug 8687
Alias: None
Product: Koha
Classification: Unclassified
Component: Notices (show other bugs)
Version: master
Hardware: All All
: P5 - low trivial (vote)
Assignee: Sophie MEYNIEUX
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-04 15:23 UTC by Sophie MEYNIEUX
Modified: 2014-08-18 22:03 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 9208 : Add utf-8 encoding when generating pdf letters from html files. (703 bytes, patch)
2012-12-04 15:28 UTC, Sophie MEYNIEUX
Details | Diff | Splinter Review
Bug 9208 : Add utf-8 encoding when generating pdf letters from html files. (757 bytes, patch)
2012-12-07 16:22 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 9208 : Fix encoding of overdue letters (1.04 KB, patch)
2014-06-13 15:55 UTC, Sophie MEYNIEUX
Details | Diff | Splinter Review
Bug 9208 : Fix encoding of overdue letters (1.04 KB, patch)
2014-06-16 12:54 UTC, Sophie MEYNIEUX
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 9208 : Fix encoding of overdue letters (1.09 KB, patch)
2014-08-15 02:05 UTC, Srdjan Jankovic
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Sophie MEYNIEUX 2012-12-04 15:23:21 UTC
When pdf files are generated from html, diacritics ar not correctly encoded. This patch forces encoding to utf-8
Comment 1 Sophie MEYNIEUX 2012-12-04 15:28:13 UTC Comment hidden (obsolete)
Comment 2 Kyle M Hall 2012-12-07 16:22:06 UTC Comment hidden (obsolete)
Comment 3 Marcel de Rooy 2013-01-20 17:31:11 UTC
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
Comment 4 Jared Camins-Esakov 2013-01-24 15:52:24 UTC
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.
Comment 5 Jared Camins-Esakov 2013-02-07 05:47:42 UTC
Marking failed QA until I have an answer about how to reproduce.
Comment 6 Sophie MEYNIEUX 2014-06-13 15:55:46 UTC Comment hidden (obsolete)
Comment 7 Sophie MEYNIEUX 2014-06-13 16:09:28 UTC
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
Comment 8 Sophie MEYNIEUX 2014-06-16 12:54:27 UTC Comment hidden (obsolete)
Comment 9 Sophie MEYNIEUX 2014-06-16 12:57:40 UTC
Fixing some typo in the patch
Comment 10 Srdjan Jankovic 2014-08-15 02:05:57 UTC
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>
Comment 11 Katrin Fischer 2014-08-16 08:55:16 UTC
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/>
Comment 12 Katrin Fischer 2014-08-16 09:05:24 UTC
I think there is an overlap of this patch and bug 8687 in both fixing the encoding.
Comment 13 Katrin Fischer 2014-08-18 22:03:35 UTC
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 ***