From: Don Armstrong Date: Thu, 14 Mar 2013 22:04:07 +0000 (-0700) Subject: Merge branch 'master' of git+ssh://git.donarmstrong.com/srv/git/debbugs X-Git-Tag: release/2.6.0~308 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ca9a45a0d04dd68229ed0f840c51eaca15ac1120;hp=e5cda269a9c62363a31d2a9f53e8c5850bcb52eb;p=debbugs.git Merge branch 'master' of git+ssh://git.donarmstrong.com/srv/git/debbugs --- diff --git a/Debbugs/Control.pm b/Debbugs/Control.pm index 4b3a02a..0390ba7 100644 --- a/Debbugs/Control.pm +++ b/Debbugs/Control.pm @@ -3467,7 +3467,7 @@ sub append_action_to_log{ $msg = ''; if ((ref($param{message}) and @{$param{message}}) or length($param{message})) { push @records, {type => exists $param{recips}?'recips':'incoming-recv', - exists $param{recips}?(recips => [make_list($param{recips})]):(), + exists $param{recips}?(recips => [map {encode_utf8_safely($_)} make_list($param{recips})]):(), text => join('',make_list($param{message})), }; } diff --git a/Debbugs/Log.pm b/Debbugs/Log.pm index 8b99b7d..551fd39 100644 --- a/Debbugs/Log.pm +++ b/Debbugs/Log.pm @@ -405,6 +405,15 @@ sub write_log_records if (defined $recips) { croak "recips not undef or array" unless ref($recips) eq 'ARRAY'; + my $wrong_encoding = 0; + my @recips = + map { if (is_utf8($_)) { + $wrong_encoding=1; + encode_utf8($_); + } else { + $_; + }} @$recips; + carp('Recipients was in the wrong encoding (perl internal instead of utf8 octets') if $wrong_encoding; print {$logfh} join("\04", @$recips) . "\n" or die "Unable to write to logfile: $!"; } else { diff --git a/Debbugs/Status.pm b/Debbugs/Status.pm index 7d72c03..c66ab41 100644 --- a/Debbugs/Status.pm +++ b/Debbugs/Status.pm @@ -1615,6 +1615,7 @@ sub update_realtime { my $idx_new = IO::File->new($file.'.new','w') or die "Couldn't open ${file}.new: $!"; + binmode($idx_new,':raw:encoding(UTF-8)'); my $min_bug = min(keys %bugs); my $line; my @line; diff --git a/scripts/gen-indices b/scripts/gen-indices index 0fe8ea8..7a8670d 100755 --- a/scripts/gen-indices +++ b/scripts/gen-indices @@ -83,6 +83,7 @@ use Debbugs::Config qw(:config); use Debbugs::Common qw(getparsedaddrs getbugcomponent lockpid); use Debbugs::Status qw(readbug split_status_fields); use Debbugs::Log; +use Debbugs::UTF8 qw(encode_utf8_structure); chdir($config{spool_dir}) or die "chdir $config{spool_dir} failed: $!"; @@ -198,7 +199,7 @@ while (my $dir = shift @dirs) { next; } next if $stat->mtime < $time; - my $fdata = split_status_fields(readbug($bug, $initialdir)); + my ($fdata) = encode_utf8_structure(split_status_fields(readbug($bug, $initialdir))); $modification_made = 1; addbugtoindex("package", $bug, make_list($fdata->{package})); addbugtoindex("tag", $bug, make_list($fdata->{keywords})); diff --git a/scripts/process b/scripts/process index 73eebb0..17aa15b 100755 --- a/scripts/process +++ b/scripts/process @@ -1207,7 +1207,7 @@ sub sendmessage { write_log_records(logfh => $logfh, records => {text => stripbccs($msg), type => 'recips', - recips => [@{$recips}], + recips => [map {encode_utf8($_)} @{$recips}], }, ); if (ref($bcc)) { diff --git a/t/13_utf8_mail.t b/t/13_utf8_mail.t index 4eda888..d5397dc 100644 --- a/t/13_utf8_mail.t +++ b/t/13_utf8_mail.t @@ -53,7 +53,7 @@ END{ send_message(to=>'submit@bugs.something', headers => [To => 'submit@bugs.something', - From => 'foo@bugs.something', + From => 'foöff@bugs.something', Subject => 'Submiting a bug', ], body => < [{Type=>"text/plain",Charset=>"utf-8",Data=><