From: Don Armstrong Date: Sun, 8 Jul 2012 16:56:03 +0000 (-0700) Subject: Debbugs::Log no longer attempts to convert to perl's internal encoding X-Git-Tag: release/2.6.0~370 X-Git-Url: https://git.donarmstrong.com/?p=debbugs.git;a=commitdiff_plain;h=ce7050c06e80846da12fcb947bc4d583d9e402fa Debbugs::Log no longer attempts to convert to perl's internal encoding --- diff --git a/Debbugs/CGI/Bugreport.pm b/Debbugs/CGI/Bugreport.pm index 0b19bab..d8bdb15 100644 --- a/Debbugs/CGI/Bugreport.pm +++ b/Debbugs/CGI/Bugreport.pm @@ -333,9 +333,11 @@ sub handle_record{ my $output = decode_utf8(''); local $_ = $record->{type}; if (/html/) { - my ($time) = $record->{text} =~ //; - my $class = $record->{text} =~ /^(?:Acknowledgement|Reply|Information|Report|Notification)/m ? 'infmessage':'msgreceived'; - $output .= decode_rfc1522($record->{text}); + # $record->{text} is not in perl's internal encoding; convert it + my $text = decode_utf8($record->{text}); + my ($time) = $text =~ //; + my $class = $text =~ /^(?:Acknowledgement|Reply|Information|Report|Notification)/m ? 'infmessage':'msgreceived'; + $output .= decode_rfc1522($text); # Link to forwarded http:// urls in the midst of the report # (even though these links already exist at the top) $output =~ s,((?:ftp|http|https)://[\S~-]+?/?)((?:[\)\'\:\.\,]|\&\#39;)?(?:\s|\.<|$)),$1$2,go; diff --git a/Debbugs/Log.pm b/Debbugs/Log.pm index 89b14d5..2ae7af7 100644 --- a/Debbugs/Log.pm +++ b/Debbugs/Log.pm @@ -51,6 +51,11 @@ The Debbugs::Log module provides a convenient way for scripts to read and write the .log files used by debbugs to store the complete textual records of all bug transactions. +Debbugs::Log does not decode utf8 into perl's internal encoding or +encode into utf8 from perl's internal encoding. For html records and +all recips, this should probably be done. For other records, this should +not be needed. + =head2 The .log File Format .log files consist of a sequence of records, of one of the following four @@ -201,7 +206,6 @@ sub new die "Unable to open bug log $bug_log for reading: $!"; } - binmode($self->{logfh},':utf8'); $self->{state} = 'kill-init'; $self->{linenum} = 0; return $self;