Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 78716
Status: rejected
Priority: 0/
Queue: Email-MIME

People
Owner: Nobody in particular
Requestors: RANGERER [...] cpan.org
Cc:
AdminCc:

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



Subject: use utf8 causes encoding issues
When using unicode characters in Email::MIME the result from as_string() is sometimes double encoded utf-8. In the attached test script this behaviour is triggered by having a use utf8 to correctly interpret the inline utf8 strings. Normal output from as_string() can be triggered by including the no utf8 clause (commented out). Imho the main problem is that Email::MIME is joining byte strings (when creating a message to be sent) and depending on the context (e.g. use utf8) will have those strings interpreted as utf-8 strings. This will result in the bytes being encoded twice (as seen in the test script).
Subject: test.pl
use utf8; use Encode; use Devel::Peek; use Email::MIME; $subject = 'Bestätigung'; Dump( $subject ); $message = 'Hello Wörld'; Dump( $message ); #no utf8; my $mail = Email::MIME->create( header_str => [ Subject => $subject, ], attributs => { content_type => 'multipart/alternative', }, parts => [ Email::MIME->create( attributes => { content_type => 'text/plain', charset => 'utf-8', encoding => '8bit', }, body_str => $message, #body => encode_utf8($message), ), Email::MIME->create( attributes => { content_type => 'text/html', charset => 'utf-8', encoding => '8bit', }, body_str => $message, #body => encode_utf8($message), ), ], ); Dump( $mail->as_string );
I apologize: whatever it is your test is supposed to make clear, I am not seeing it. Would you please restate it as a "real" test using Test::More or the like? That will provide very clear assertions. Also, please let me know with what version of perl you are running. Thanks. -- rjbs
With no further information, I can't do anything. I spent a bit more time looking for a problem, but either I'm very thick or it's not there. -- rjbs