]> git.donarmstrong.com Git - debbugs.git/commitdiff
fix wrong encoding of $fwd; put the debug handle into utf8 encoding mode
authorDon Armstrong <don@donarmstrong.com>
Thu, 14 Mar 2013 16:13:05 +0000 (09:13 -0700)
committerDon Armstrong <don@donarmstrong.com>
Thu, 14 Mar 2013 16:13:05 +0000 (09:13 -0700)
scripts/process

index 0524c38c75de3f2039b621d5f929eeae5b7d82e9..73eebb0c19bf81a441d9876d848dfd1c06be4495 100755 (executable)
@@ -79,6 +79,7 @@ my $debugfh = IO::File->new('/dev/null','w') or
 if ($DEBUG > 0) {
     $debugfh = \*STDERR;
 }
+binmode($debugfh,':raw:encoding(UTF-8)');
 
 # these are the valid bug addresses
 my %baddress = (B => 'submit',
@@ -174,13 +175,14 @@ my %header;
 
 my @common_headers;
 for my $hdr (@headerlines) {
+    my $orig_hdr = $hdr;
     $hdr = decode_rfc1522($hdr);
     $_ = $hdr;
     s/\n\s/ /g;
     finish() if m/^x-loop: (\S+)$/i && $1 eq "$gMaintainerEmail";
     my $ins = !m/^subject:/i && !m/^reply-to:/i && !m/^return-path:/i
            && !m/^From / && !m/^X-Debbugs-/i;
-    $fwd .= $hdr."\n" if $ins;
+    $fwd .= encode_utf8($hdr)."\n" if $ins;
     # print {$debugfh} ">$_<\n";
     if (s/^(\S+):\s*//) {
        my $v = lc $1;
@@ -248,7 +250,9 @@ my $i = 0;
 ++$i while $msg[$i] =~ /./;
 $fwd .= join("\n",@msg[$i..$#msg]);
 
+binmode($debugfh,':raw');
 print {$debugfh} "***\n$fwd\n***\n";
+binmode($debugfh,':raw:encoding(UTF-8)');
 
 if (defined $header{'resent-from'} && !defined $header{'from'}) {
     $header{'from'} = $header{'resent-from'};