Skip Menu |

This queue is for tickets about the Apache-GzipChain CPAN distribution.

Report information
The Basics
Id: 28732
Status: open
Priority: 0/
Queue: Apache-GzipChain

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.14
Fixed in: (no value)



Subject: Wrong usage of encode_utf8
Using encode_utf8 in the PRINT method of Apache::OutputChain is wrong. The comment behind claims that it's a no-op but it isn't, as high-bit characters would turn into utf-8 encoded characters. It's better to just check if the utf8 flag is set in the string and just remove the flag. Maybe it would also be appropriate to issue a warning a la "wide character in PRINT", because I consider it an error to have utf8-flagged characters in this stage. Regards, Slaven
Subject: Apache-GzipChain.diff
--- /usr/local/lib/perl5/site_perl/5.8.8/Apache/GzipChain.pm Mon Mar 3 12:49:42 2003 +++ /home/e/eserte/trash/Apache/GzipChain.pm Wed Aug 8 17:45:20 2007 @@ -2,7 +2,7 @@ package Apache::GzipChain; use Compress::Zlib 1.0; use strict; use vars qw(@ISA $VERSION); -$VERSION = sprintf "%d.%02d", q$Revision: 1.14 $ =~ /(\d+).(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.15 $ =~ /(\d+).(\d+)/; use Apache::OutputChain; @ISA = qw( Apache::OutputChain ); @@ -35,7 +35,9 @@ sub PRINT { return unless length($res); if ($] > 5.007) { require Encode; - $res = Encode::encode_utf8($res); # noop if $res doesn't have the UTF-8 flag set + if (Encode::is_utf8($res)) { + Encode::_utf8_off($res); + } } $self->Apache::OutputChain::PRINT(Compress::Zlib::memGzip($res)); }
On Wed Aug 08 11:53:23 2007, SREZIC wrote: Show quoted text
> Using encode_utf8 in the PRINT method of Apache::OutputChain is wrong. > The comment behind claims that it's a no-op but it isn't, as high-bit > characters would turn into utf-8 encoded characters. It's better to > just check if the utf8 flag is set in the string and just remove the flag. > Maybe it would also be appropriate to issue a warning a la "wide character > in PRINT", because I consider it an error to have utf8-flagged characters > in this stage. > > Regards, > Slaven
Ping...