Skip Menu |

This queue is for tickets about the MIME-tools CPAN distribution.

Report information
The Basics
Id: 105377
Status: rejected
Priority: 0/
Queue: MIME-tools

People
Owner: dfs+pause [...] roaringpenguin.com
Requestors: peter [...] sysnix.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: MIME::Entity->build barfs with non-utf8 input for Perl >= 5.18
Date: Fri, 19 Jun 2015 14:35:49 +0200
To: bug-MIME-tools [...] rt.cpan.org
From: Peter Mottram <peter [...] sysnix.com>
PerlIO bug fixed in 5.18: http://blogs.perl.org/users/tony_cook/2013/02/perl-io-on-scalars.html https://rt.perl.org/Public/Bug/Display.html?id=109828 Causes breakage: $ perl -MMIME::Entity -e 'MIME::Entity->build( Data => "\x{1f4a9}" )->print' Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: binary MIME-Version: 1.0 X-Mailer: MIME-tools 5.506 (Entity 5.506) open body: Invalid argument at /home/apm/perl5/perlbrew/perls/perl-5.20.2/lib/site_perl/5.20.2/MIME/Entity.pm line 1878. Earlier Perls most likely would end up with garbage so this needs fixing for everyone. I'm afraid my unicode skills are not up to creating a patch for this one. Regards PeteM
Subject: Re: [rt.cpan.org #105377] MIME::Entity->build barfs with non-utf8 input for Perl >= 5.18
Date: Fri, 19 Jun 2015 11:21:42 -0400
To: bug-MIME-tools [...] rt.cpan.org
From: Dianne Skoll <dfs [...] roaringpenguin.com>
On Fri, 19 Jun 2015 08:36:09 -0400 "Peter Mottram via RT" <bug-MIME-tools@rt.cpan.org> wrote: Show quoted text
> Causes breakage: > $ perl -MMIME::Entity -e 'MIME::Entity->build( Data => "\x{1f4a9}" )->print'
Hmm, wow. Thanks. I'll have to think about a sane way to cope with this. I'm tempted to say "don't do that!" but I realize that's not a very good answer. Regards, Dianne.
Subject: Re: [rt.cpan.org #105377] MIME::Entity->build barfs with non-utf8 input for Perl >= 5.18
Date: Fri, 19 Jun 2015 17:42:02 +0200
To: bug-MIME-tools [...] rt.cpan.org
From: Peter Mottram <peter [...] sysnix.com>
On 19/06/15 17:21, David F. Skoll via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=105377 > > > On Fri, 19 Jun 2015 08:36:09 -0400 > "Peter Mottram via RT" <bug-MIME-tools@rt.cpan.org> wrote: >
>> Causes breakage: >> $ perl -MMIME::Entity -e 'MIME::Entity->build( Data => "\x{1f4a9}" )->print'
> Hmm, wow. Thanks. I'll have to think about a sane way to cope with this. > I'm tempted to say "don't do that!" but I realize that's not a very > good answer. >
Sadly true. This came up in #dancer with op wondering why they got that weird exception from Dancer::Plugin::Email. One thought was to patch DPE but that only fixes a small part of the ME userbase and we'd have to start hunting down all other consumers and patching each one but that could be an endless task.
Hi, This is not a bug in MIME::Tools. MIME::Entity requires encoded data if you supply the Data => 'xxx' key. Rather than supplying native Unicode strings, you should encode them first. Sample below illustrates what I mean. Regards, Dianne. use Encode; use MIME::Entity; my $data = "\x{1f4a9}"; my $e = MIME::Entity->build(Data => Encode::encode('UTF-8', $data, Encode::FB_CROAK)); $e->print();
On Wed Dec 13 16:40:52 2017, DSKOLL wrote: Show quoted text
> Hi, > > This is not a bug in MIME::Tools.
Valid point, however the non-bug is also "fixed" by this patch to MIME::Body which I believe fixes something that IS a bug... --- Body.pm.old 2017-04-05 12:55:57.000000000 -0400 +++ Body.pm.new 2017-12-13 19:04:27.000000000 -0500 @@ -139,6 +139,7 @@ ### System modules: use Carp; use IO::File; +use IO::Scalar; ### The package version, both in 1.23 style *and* usable by MakeMaker: $VERSION = "5.509"; @@ -522,7 +523,7 @@ die "bad mode: $mode"; } - return IO::File->new(\ $self->{MBS_Data}, $mode); + return IO::Scalar->new(\ $self->{MBS_Data}, $mode); }
Sorry, I will not be applying this patch as it will cause other problems down the road. See the section "Byte and Character Semantics" in the perlunicode man page. Regards, Dianne.