From: Jonathan S. <jn...@ge...> - 2006-03-03 10:55:15
|
On Thu, 2006-03-02 at 21:22, Steven Mackenzie wrote: > A proposal to add a Content-type header to the mails sent by > FormMail.pm, so that the emails include the charset that the user > configured in FormMail.pl: > > One of the user configurable parameters in FormMail.pl is charset. > > My HTML form is written in UTF-8, I have set charset to UTF-8, and > posted data is emailed to me as UTF-8. Unfortunately, the emails do not > use the Content-type header, so my mail client displays them in a > default characterset, which is not UTF-8. > > Adding these two lines of code to FormMail.pm resolve the issue: > > After FormMail.pl: Line 1285 > $self->mailer->print("Content-Type: text/plain; > charset=".$self->{CFG}{charset}."\n"); > > After FormMail.pl: Line 1122 > Content-Type: text/plain; charset=${\( $self->{CFG}{charset} )} > > http://www.ietf.org/rfc/rfc1049.txt - content type header for email > http://www.sendmail.org/rfc/0822.html#4 - headers may be in any order > > This was helpful for me. is it contentious? > This is a little tricky, the problem being that putting that header is making a guarantee that the program possibly can't keep. Firstly we can't know what has happened to the program after it has been downloaded, the encoding of the program file could be changed by some editor or it might be changed during the upload process - this will affect the actual encoding of the output, and as we are only using the charset to do encoding sensitive sanitizing of the input data for the output and not actually coercing the encoding of the output it is possible that the actual output is not going to get the encoding supplied in 'charset'. The other problem and one which militates against our being able to fix the first by coercing the output is that with the legacy programs such as FormMail we are committed to being able to support versions of Perl as old as 5.004.04 and before the 5.6.0 release there was virtually no support for unicode and it couldn't really be said to be perfect until 5.8.1 so we could have a problem with properly handling the encodings properly as I see it, unless of course someone wants to persuade me differently. On the flip side if people were concerned about setting an appropriate Content-Type we would probably recommend them to use TFmail as this uses a slightly modified version of the MIME::Lite module to do the MIME bits for us. /J\ -- This e-mail is sponsored by http://www.integration-house.com/ |