Subject: | Problem writing utf8 strings to file handles |
Date: | Wed, 29 Jun 2016 11:22:40 +0100 |
To: | bug-Archive-Zip [...] rt.cpan.org |
From: | Paul McKay <paul.g.mckay [...] gmail.com> |
Hi all,
Problem seen on version 1.57 on perl 5.16.2 on my mac, Darwin Kernel
Version 13.4.0
Also reproduced on perl 5.18.4 on linux kernel 2.6.18-164.2.1.el5.plus
I've boiled down the problem to be reproduced with this script,( although
it was first seen writing data to a zip that was pulled from a database,
where the utf8 pragma was not used, it's used here to illustrate the error)
#!/usr/bin/env perl
use strict;
use Archive::Zip;
use utf8;
my $data = '€';
my $zip = Archive::Zip->new();
$zip->addString($data,'data.txt');
$zip->writeToFileNamed('/tmp/data.zip');
This errors out with
Wide character in Compress::Raw::Zlib::crc32 at
/usr/local/perl/lib/site_perl/5.18.4/Archive/Zip.pm line 330.
Any help with this much appreciated. At the moment I'm having to look to
work around Archive::Zip completely by using temporary files and system
commands, not ideal.
Paul.