From a01180f63f5f704cdcb266f8f80e87fb07941439 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Thu, 14 Mar 2013 14:16:25 -0700 Subject: [PATCH] warn if recips is in the wrong encoding --- Debbugs/Log.pm | 9 +++++++++ 1 file changed, 9 insertions(+) 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 { -- 2.39.2