问题
My .procmailrc (really simple):
:0c
| $HOME/send_sms.sh "`formail -xFrom:`" "`formail -xSubject:`"
So, sender named "mail@domain.com" sends message with subject "Subject test ąść". The script "send_sms.sh" receives:
Sender: =?UTF-8?Q?mail@domain.com?= <mail@domain.com>
Subject: =?UTF-8?Q?Subject_test_=C4=85=C5=9B=C4=87?=
How should I modify my .procmailrc to get clear text? Or convert this in my script send_sms.sh ?
回答1:
http://metacpan.org/pod/Email::MIME::RFC2047::Decoder has a simple RFC2047 decoder in Perl. You should perhaps only decode strings which are in a character set you can support, but all your examples are in UTF-8, so if your script supports sending UTF-8 in SMS, you should be fine. For other character sets, perhaps you can convert into UTF-8 in a separate step before sending.
来源:https://stackoverflow.com/questions/11726354/sendmail-procmail-get-mail-sender-and-mail-subject-utf8-encoding-issues