]> git.donarmstrong.com Git - debbugs.git/commitdiff
Debbugs::Log no longer attempts to convert to perl's internal encoding
authorDon Armstrong <don@donarmstrong.com>
Sun, 8 Jul 2012 16:56:03 +0000 (09:56 -0700)
committerDon Armstrong <don@donarmstrong.com>
Sun, 8 Jul 2012 16:56:03 +0000 (09:56 -0700)
Debbugs/CGI/Bugreport.pm
Debbugs/Log.pm

index 0b19bab636029b1d0324fe6fffc7b242ff6c8587..d8bdb15952af71d0d921873e2435f40a10f3c017 100644 (file)
@@ -333,9 +333,11 @@ sub handle_record{
      my $output = decode_utf8('');
      local $_ = $record->{type};
      if (/html/) {
      my $output = decode_utf8('');
      local $_ = $record->{type};
      if (/html/) {
-         my ($time) = $record->{text} =~ /<!--\s+time:(\d+)\s+-->/;
-         my $class = $record->{text} =~ /^<strong>(?: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 =~ /<!--\s+time:(\d+)\s+-->/;
+         my $class = $text =~ /^<strong>(?: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|\.<|$)),<a href=\"$1\">$1</a>$2,go;
          # 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|\.<|$)),<a href=\"$1\">$1</a>$2,go;
index 89b14d5d04d90642761dbe9ae3c8e7561ff50179..2ae7af7b919705b1e859f55cfc686a0741ab980c 100644 (file)
@@ -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.
 
 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
 =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: $!";
     }
 
              die "Unable to open bug log $bug_log for reading: $!";
     }
 
-    binmode($self->{logfh},':utf8');
     $self->{state} = 'kill-init';
     $self->{linenum} = 0;
     return $self;
     $self->{state} = 'kill-init';
     $self->{linenum} = 0;
     return $self;