https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44125

--- Comment #5 from Emily Lamancusa (emlam) 
<[email protected]> ---
Created attachment 212321
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212321&action=edit
Bug 44125: Encode the serial claims CSV export as UTF-8

serials/lateissues-export.pl printed the CSV without an encoding layer
on STDOUT, so every non-ASCII character was written as a single Latin-1
byte. The header was sent as "plain/text", which is not a valid media
type, and CGI added its default "charset=ISO-8859-1". Opened as UTF-8,
the file showed U+FFFD instead of the accented characters, both in the
data (title, issue number, vendor) and in the CSV profile headers.

This patch sets binmode STDOUT to UTF-8 before printing, as other CSV
exports do (tools/inventory.pl, reports/serials_stats.pl), and sends
the file as text/csv with charset UTF-8.

Steps to follow:
1. Create a vendor, and a subscription with that vendor for a record
   whose title has accented characters, e.g. "Año de la filosofía".
2. Make one of its issues late (status Late, planned date in the
   past), with an accented issue number, e.g. "Año 1, núm. 2".
3. Optional: create a CSV profile of type "Late issues" with accented
   headers, e.g. Título=title|Número=serialseq|Proveedor=name
4. Go to Serials > Claims, choose the vendor, select the issue, choose
   the CSV profile and click "Download selected claims".
5. Open the CSV as UTF-8: the accented characters show as "�"
   (e.g. "A�o de la filosof�a").
6. Apply this patch and restart services.
7. Repeat step 4 and open the new CSV: the accented characters are
   correct, in the data and in the headers.
8. Check that the response is sent as "text/csv; charset=UTF-8"
   (e.g. in the browser developer tools, Network tab).

Signed-off-by: Adolfo Rodríguez <[email protected]>
Signed-off-by: Michael Mundet <[email protected]>
Signed-off-by: Emily Lamancusa <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to