Subject: | weird unicode mess when using some regexps UNRELATED to object! |
hi
I mark this bug as critical because it should NOT happen... ever...
GOOD EXAMPLE
---------------- 8< ----------------
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use MIME::Lite;
use Encode;
my $msg = MIME::Lite->new(
'From' => '"X" <x@bbkr.org>',
'To' => '"Y" <y@bbkr.org>',
'Subject' => 'Hello',
'Type' => 'text/plain',
'Encoding' => 'quoted-printable',
'Data' => Encode::encode_utf8('zażółć gęślą jaźń'),
);
$msg->attr('Content-Type.charset' => 'utf8');
print $msg->body_as_string();
---------------- 8< ----------------
this GOOD example prints as expected:
---------------- 8< ----------------
za=C5=BC=C3=B3=C5=82=C4=87 g=C4=99=C5=9Bl=C4=85 ja=C5=BA=C5=84=
---------------- 8< ----------------
BAD EXAMPLE
---------------- 8< ----------------
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use MIME::Lite;
use Encode;
my $msg = MIME::Lite->new(
'From' => '"X" <x@bbkr.org>',
'To' => '"Y" <y@bbkr.org>',
'Subject' => 'Hello',
'Type' => 'text/plain',
'Encoding' => 'quoted-printable',
'Data' => Encode::encode_utf8('zażółć gęślą jaźń'),
);
$msg->attr('Content-Type.charset' => 'utf8');
my $unrelated = 'Śómę Uńićodę'; # NEW
$unrelated =~ s/(?<=\b)(\S)/\U$1/g; # NEW
print $msg->body_as_string();
---------------- 8< ----------------
And this dies with following message:
---------------- 8< ----------------
Wide character in subroutine entry at
/usr/lib/perl5/vendor_perl/5.8.8/MIME/Lite.pm line 2262.
---------------- 8< ----------------
So completly UNRELATED code (even executed in some other namespace) can
mess MIME::Lite object.
Please fix it fast :)