Make perlbug encoding-agnostic in handling prepared reports.
authorCraig A. Berry <craigberry@mac.com>
Sat, 29 Mar 2014 20:44:03 +0000 (15:44 -0500)
committerCraig A. Berry <craigberry@mac.com>
Fri, 11 Apr 2014 02:42:16 +0000 (21:42 -0500)
Guessing the encoding of a report file prepared ahead of time is
really, well, too much guesswork, plus there are at least a couple
of mistakes in the implementation.  And we weren't even trying to
guess for reports created on-the-fly in an editor, which is a bit
inconsistent.

So handle prepared reports the same way as on-the-fly reports and
attachments, which means all I/O is done using the :raw layer.

This is only "Unicode-aware" in the sense that we're aware there
are a lot of encodings out there and we're trying not to mangle
them in transit by accidental conversion.  We're not doing any
explicit character set conversions and we shouldn't assert in the
MIME headers that we know what character set we're sending because
we don't.

utils/perlbug.PL

index 42e8a24..85fb134 100644 (file)
@@ -76,8 +76,6 @@ BEGIN {
     $::HaveTemp = ($@ eq "");
     eval { require Module::CoreList; };
     $::HaveCoreList = ($@ eq "");
-    eval { require encoding; };
-    $::Have_get_locale_encoding = ($@ eq "" && defined &encoding::_get_locale_encoding);
 };
 
 my $Version = "1.40";
@@ -99,8 +97,6 @@ my $perl_version = $^V ? sprintf("%vd", $^V) : $];
 
 my $config_tag2 = "$perl_version - $Config{cf_time}";
 
-my $input_encoding = $::Have_get_locale_encoding ? encoding::_get_locale_encoding() : '';
-
 Init();
 
 if ($opt{h}) { Help(); exit; }
@@ -616,7 +612,7 @@ EOF
     if ($body) {
        print REP $body;
     } elsif ($usefile) {
-       open(F, "<:$input_encoding", $file)
+       open(F, '<:raw', $file)
                or die "Unable to read report file from '$file': $!\n";
        while (<F>) {
            print REP $_
@@ -1050,7 +1046,7 @@ sub _add_body_start {
     my $body_start = <<"BODY_START";
 This is a multi-part message in MIME format.
 --$mime_boundary
-Content-Type: text/plain; charset=UTF-8; format=fixed
+Content-Type: text/plain; format=fixed
 Content-Transfer-Encoding: 8bit
 
 BODY_START