From 206de410efd7d1d14692024275ff812b0e0dcbd4 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Sun, 8 Jul 2012 09:12:59 -0700 Subject: [PATCH] git rid of encoding in Debbugs::Log; everything should be escaped before here. --- Debbugs/Log.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; } -- 2.39.2