Re: Body charset for Mail::Message::Field::Full
Mark Overmeer <[email protected]> Fri, 3 Sep 2004 11:38:14 +0200
| Newsgroups | gmane.comp.lang.perl.modules.mail-box |
|---|---|
| Organization | MARKOV Solutions |
| Message-ID | <[email protected]> |
* Mike Mimic ([email protected]) [040828 15:01]: > 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'); The purpose of the field object is not only to produce header fields for out-going mail, but also to handle and understand it in the running application. For the latter, it is very important to be consistent. There are only two ways of being consistent (in Perl): pure ASCII and UTF8. Imagin that I would create $disp = Mail::Message::Field::Full->new ( 'Content-Disposition: attachment; filename="xyz"' , charset => 'windows-1250' ); my $body = Mail::Message::Body->new ( dispostion => $disp , ... ); and then my $fn = $msg->body->dispositionFilename; would give inconsistent results. Ok, this is a complex example, but I am sure there are hazards all over the place. IMO, using other encodings that ASCII and UTF8 inside a Perl program will be horrible to maintain. As second point: a header field should not be in "windows-1250": only ASCII is permitted by the RFCs. When non-ascii (7 bit) characters appear, they should be encoded with =?Q?windows-1250?...?= I know it is not practice, but it is standards compliant. So: I do not have a possitive feeling for your proposal. -- MarkOv ------------------------------------------------------------------------ drs Mark A.C.J. Overmeer MARKOV Solutions [email protected] [email protected] http://Mark.Overmeer.net http://solutions.overmeer.net