combraxis has asked for the wisdom of the Perl Monks concerning the following question:
I have a test html page with form which uses sendmail to send an email with data from the form. The input data includes characters like éêä £ €
The test page and the script it runs are on an Apache Linux web server.
if the html page has a character set of windows-1252 (default for Expression Web) those characters come out correctly in the email.
if the html page has character set of utf-8 those characters come out as garbled text (eg: £ €).
here is the sendmail code:
unless (open(LOG_FILE, ">test_sendmail_log.txt")) { die "Couldn't open output file test_sendmail_log.txt\n"; } print LOG_FILE "$body"; open (MERCHANT_MAIL, "|/usr/sbin/sendmail -oi -t") or die "Can't fork for sendmail: $!\n"; print MERCHANT_MAIL "To: $send_addr\n"; print MERCHANT_MAIL "From: $from_addr\n"; print MERCHANT_MAIL "Subject: $subject\n\n"; print MERCHANT_MAIL $body; close (MERCHANT_MAIL); close(LOG_FILE);
A log file saved at the same time displays all characters correctly, whichever charset the html page has.
The html pages for which I am testing have charset=utf8 - how can I get sendmail to send such characters correctly?
Thank you
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sendmail problem with utf-8 charset
by Corion (Patriarch) on Nov 22, 2014 at 12:21 UTC | |
by combraxis (Novice) on Nov 22, 2014 at 16:34 UTC | |
|
Re: sendmail problem with utf-8 charset
by Anonymous Monk on Nov 22, 2014 at 13:31 UTC | |
by Anonymous Monk on Nov 22, 2014 at 13:39 UTC |