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 {
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;
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: $!";
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}));
write_log_records(logfh => $logfh,
records => {text => stripbccs($msg),
type => 'recips',
- recips => [@{$recips}],
+ recips => [map {encode_utf8($_)} @{$recips}],
},
);
if (ref($bcc)) {
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 => <<EOF,attachments => [{Type=>"text/plain",Charset=>"utf-8",Data=><<EOF2}]) or fail('Unable to send message');