Skip Menu |

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

Report information
The Basics
Id: 56898
Status: new
Priority: 0/
Queue: MIME-Lite

People
Owner: Nobody in particular
Requestors: berov [...] bulgarian-creative-circle.org
Cc:
AdminCc:

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



Subject: Subject is broken when text is encoded in UTF-8 nd using SENDMAIL
Date: Sun, 25 Apr 2010 01:57:21 +0300
To: bug-MIME-Lite [...] rt.cpan.org
From: Красимир Беров <berov [...] bulgarian-creative-circle.org>
Hi, This was reported before on http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg178863.html as: Bug#360862: libmime-lite-perl: "Wide character in print" warning But since I found a quick and dirty solution which works for me I am sharing it with you. Hope you will rewrite it so it can be used by everybody The problem is not only the warning but the broken subject line, when sending mail via sendmail. Well this could be avoided if you separate concerns of the building of the message and sending it but why not using $msg->send; and it will "just work". Here is the possible workaround taken from "send_by_sendmail" which I hacked. open my $SENDMAIL, "|$sendmailcmd" or Carp::croak "open |$sendmailcmd: $!\n"; binmode($SENDMAIL, ':encoding(UTF-8)'); $self->print( $SENDMAIL ); close $SENDMAIL; Cheers
--- install/CPAN/MIME-Lite-3.027/lib/MIME/Lite.pm 2009-10-10 05:04:04.000000000 +0300 +++ opt/private_dev/tks/lib/MIME/Lite.pm 2010-04-25 01:53:12.000000000 +0300 @@ -1,7 +1,7 @@ package MIME::Lite; use strict; require 5.004; ### for /c modifier in m/\G.../gc modifier - +use Encode; =head1 NAME MIME::Lite - low-calorie MIME generator @@ -2256,7 +2256,7 @@ while ( $untainted =~ m{^(.*[\r\n]*)}smg ) { ### have to do it line by line... my $line = $1; # copy to avoid weird bug; rt 39334 - $out->print( encode_qp($line) ); + $out->print( encode_qp(Encode::encode_utf8($line)) ); } last DATA; }; @@ -2685,10 +2685,10 @@ Carp::croak "No sendmail command available" unless $sendmailcmd; ### Do it: - local *SENDMAIL; - open SENDMAIL, "|$sendmailcmd" or Carp::croak "open |$sendmailcmd: $!\n"; - $self->print( \*SENDMAIL ); - close SENDMAIL; + open my $SENDMAIL, "|$sendmailcmd" or Carp::croak "open |$sendmailcmd: $!\n"; + binmode($SENDMAIL, ':encoding(UTF-8)'); + $self->print( $SENDMAIL ); + close $SENDMAIL; $return = ( ( $? >> 8 ) ? undef: 1 ); } else { ### Build the command... my %p = $self->_unfold_stupid_params(@_);