From: Don Armstrong Date: Sun, 8 Jul 2012 16:12:59 +0000 (-0700) Subject: git rid of encoding in Debbugs::Log; everything should be escaped before here. X-Git-Tag: release/2.6.0~372 X-Git-Url: https://git.donarmstrong.com/?p=debbugs.git;a=commitdiff_plain;h=206de410efd7d1d14692024275ff812b0e0dcbd4 git rid of encoding in Debbugs::Log; everything should be escaped before here. --- diff --git a/Debbugs/Log.pm b/Debbugs/Log.pm index 96748b7..89b14d5 100644 --- a/Debbugs/Log.pm +++ b/Debbugs/Log.pm @@ -384,6 +384,9 @@ sub write_log_records for my $record (@records) { my $type = $record->{type}; croak "record type '$type' with no text field" unless defined $record->{text}; + # I am not sure if we really want to croak here; but this is + # almost certainly a bug if is_utf8 is on. + # croak "probably wrong encoding" if is_utf8($record->{text}); my ($text) = escape_log($record->{text}); if ($type eq 'autocheck') { print {$logfh} "\01\n$text\03\n" or @@ -428,7 +431,7 @@ Applies the log escape regex to the passed logfile. sub escape_log { my @log = @_; - return map { eval {$_ = is_utf8($_)?encode("utf8",$_,Encode::FB_CROAK):$_;}; s/^([\01-\07\030])/\030$1/gm; $_ } @log; + return map {s/^([\01-\07\030])/\030$1/gm; $_ } @log; }