]> git.donarmstrong.com Git - debbugs.git/commitdiff
Merge branch 'don/fix_encoding'
authorDon Armstrong <don@donarmstrong.com>
Thu, 14 Mar 2013 20:00:54 +0000 (13:00 -0700)
committerDon Armstrong <don@donarmstrong.com>
Thu, 14 Mar 2013 20:00:54 +0000 (13:00 -0700)
Debbugs/Control.pm
scripts/process
t/05_mail.t
t/13_utf8_mail.t

index 95876245ba215b59ffe4e37682af88bf0e2db0c2..4b3a02aa37daea67e05c609e2a44f35fd25a4747 100644 (file)
@@ -126,7 +126,7 @@ use IO::File;
 
 use Debbugs::Text qw(:templates);
 
-use Debbugs::Mail qw(rfc822_date send_mail_message default_headers);
+use Debbugs::Mail qw(rfc822_date send_mail_message default_headers encode_headers);
 use Debbugs::MIME qw(create_mime_message);
 
 use Mail::RFC822::Address qw();
@@ -3591,13 +3591,14 @@ sub __return_append_to_log_options{
      }
      if (not exists $param{message}) {
          my $date = rfc822_date();
-         $param{message} = fill_in_template(template  => 'mail/fake_control_message',
-                                            variables => {request_addr => $param{request_addr},
-                                                          requester    => $param{requester},
-                                                          date         => $date,
-                                                          action       => $action
-                                                         },
-                                           );
+         $param{message} =
+              encode_headers(fill_in_template(template  => 'mail/fake_control_message',
+                                              variables => {request_addr => $param{request_addr},
+                                                            requester    => $param{requester},
+                                                            date         => $date,
+                                                            action       => $action
+                                                           },
+                                             ));
      }
      if (not defined $action) {
          carp "Undefined action!";
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'};
index 3d21049c579ef9e3c994ce261fc701e674ac7fac..53860d39e82406d411cd5078e1bdae6f0b58364f 100644 (file)
@@ -25,7 +25,7 @@ blah blah blah
 END
 
 # 1: test decode
-ok(decode_rfc1522(Debbugs::Mail::encode_headers($test_str)) eq encode_utf8($test_str));
+ok(decode_rfc1522(Debbugs::Mail::encode_headers($test_str)) eq $test_str);
 
 # XXX Figure out a good way to test the send message bit of
 # Debbugs::Mail
index 2491e14c3b1f67a3382369b0d8bf0e2f2a443184..4eda888df35cd0b67dbd0a8f5776342317d9f7f4 100644 (file)
@@ -91,7 +91,7 @@ $SD_SIZE =
 
 send_message(to => '1@bugs.something',
             headers => [To   => '1@bugs.something',
-                        From => 'foo@bugs.something',
+                        From => 'föoff@bugs.something',
                         Subject => 'Sending a message to a bug',
                        ],
             body => <<EOF) or fail('sending message to 1@bugs.someting failed');
@@ -109,7 +109,7 @@ $SD_SIZE =
 # just check to see that control doesn't explode
 send_message(to => 'control@bugs.something',
             headers => [To   => 'control@bugs.something',
-                        From => 'foo@bugs.something',
+                        From => 'föoff@bugs.something',
                         Subject => 'Munging a bug',
                        ],
             body => <<EOF) or fail 'message to control@bugs.something failed';