From: Don Armstrong Date: Thu, 14 Mar 2013 21:16:25 +0000 (-0700) Subject: warn if recips is in the wrong encoding X-Git-Tag: release/2.6.0~306^2~6 X-Git-Url: https://git.donarmstrong.com/?p=debbugs.git;a=commitdiff_plain;h=a01180f63f5f704cdcb266f8f80e87fb07941439 warn if recips is in the wrong encoding --- 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 {