Body charset for Mail::Message::Field::Full

Mike Mimic <[email protected]> Sat, 28 Aug 2004 06:01:36 -0700 (PDT)
Newsgroups gmane.comp.lang.perl.modules.mail-box
Message-ID <[email protected]>
Hi!

Why should body for Mail::Message::Field::Full be
given in utf8? What if I already have a text in a
charset which I would use later on for encoding. For
example, at the moment I have to do ($text is already
in windows-1250 charset):

$subject = Mail::Message::Field::Full->new('Subject',
decode('windows-1250', $text),
charset=>'windows-1250');

Where it would be nicer (and more efficient) that I
could do just:

$subject = Mail::Message::Field::Full->new('Subject',
$text, charset=>'windows-1250');

I think that this would be possible with changing
"encode" a little:

my $encoded = Encode::encode($charset, $utf8, 0);

Could be changed to:

my $encoded = Encode::is_utf8($utf8) ?
Encode::encode($charset, $utf8, 0) : $utf8;

This way it will be converted if body is in utf8 (that
is if the urf8 flag is on) otherwise it will presume 
that it is already in desired charset.


Mike


		
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail