我正在从包含中文字符的 unix shell 脚本发送报告。
当我在像textmate这样的纯文本编辑器中打开CSV报告时,我可以看到中文字符,但是当我在Excel中打开CSV报告文件时,我看不到中文字符,而是看到一些乱码。
如何“告诉”excel该文件包含中文字符集?
以下是发送邮件并附加 CSV 文件的代码。
send_mail() {
v_mailpart="ZZ_/afg6432dfgkl.94531q"
echo "Mail to be sent to $RPT_SEND_TO"
echo "To: $RPT_SEND_TO
Subject: Blah Report as of $report_date_format;
Content-Type: multipart/mixed; boundary=\"$v_mailpart\"
MIME-Version: 1.0
This is a multi-part message in MIME format.
--$v_mailpart
Content-Type: text/html
Content-Disposition: inline
<html><body><p>Hi All,<p>Please find attached, the daily report <p>Thanks,
<br/>Blah Team</br/><br/><br/></p><p>NOTE: This is an auto-generated email. Do not reply to it. Please send an email to [email protected] in
case of any issues.<p></body></html>
--$v_mailpart
Content-Transfer-Encoding:UTF-8;
Content-Type: text/plain;charset=\"UTF-8\";
Content-Disposition: attachment; filename=blah-report.csv
`cat $spool_file5`" | /usr/sbin/sendmail -t
}