I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2008-09-15 01:35:04-07 by msandy
Error Wide character in IO::Compress::Gzip::write:
I am getting this error when trying to compress a scalar that contains 3 byte utf8 characters from Katakana... 30E2 KATAKANA LETTER MO 30EA KATAKANA LETTER RI 0020 SPACE 30DE KATAKANA LETTER MA 30B5 KATAKANA LETTER SA 30D2 KATAKANA LETTER HI Can someone help me figure out if this is a bug in Compress or am I doing something wrong ?
2008/09/14 18:14:33(9562:29482) FATAL> moxie.pl:126 main:: Wide character in IO::Compress::Gzip::write: at /usr/lib/perl5/site_perl/5.8.8/IO/Compress/Base.pm +line 577 IO::Compress::Base::syswrite('IO::Compress::Gzip=GLOB(0x96d4698)', 'SCALAR(0x93917fc)') cal +led at /usr/lib/perl5/site_perl/5.8.8/IO/Compress/Base.pm line 464 IO::Compress::Base::_wr2('IO::Compress::Gzip=GLOB(0x96d4698)', 'SCALAR(0x93917fc)', 1) call +ed at /usr/lib/perl5/site_perl/5.8.8/IO/Compress/Base.pm l ine 410 IO::Compress::Base::_singleTarget('IO::Compress::Gzip=GLOB(0x96d4698)', 'Validator=HASH(0x8 +6a8740)', 1, 'SCALAR(0x93917fc)', 'SCALAR(0x8851c8c)', 'Mi nimal', 1) called at /usr/lib/perl5/site_perl/5.8.8/IO/Compress/Base.pm line 389 IO::Compress::Base::_def('IO::Compress::Gzip=GLOB(0x96d4698)', 'SCALAR(0x93917fc)', 'SCALAR +(0x8851c8c)', 'Minimal', 1) called at /usr/lib/perl5/site_ perl/5.8.8/IO/Compress/Gzip.pm line 52 IO::Compress::Gzip::gzip('SCALAR(0x93917fc)', 'SCALAR(0x8851c8c)', 'Minimal', 1) called at +/usr/lib/perl5/site_perl/5.8.8/Compress/Zlib.pm line 450 Compress::Zlib::memGzip('<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <ser...') called at
Direct Responses: 8805 | Write a response
Posted on 2008-09-15 10:25:25-07 by pmarquess in response to 8803
Re: Error Wide character in IO::Compress::Gzip::write:
You need to explicitly encode any text into utf8 before compression. I see you are using memGzip, so here is an exmaple:
use Encode; $data = Compress::Zlib::memGzip(Encode::encode_utf8($body));
Similarly, if you want to uncompress utf8 data you need to do this
$original = Encode::decode_utf8(Compress::Zlib::memGunzip($data));
Paul
Direct Responses: Write a response