Encode::MIME::HeaderSection: Perl Programmers Reference Guide (3)Updated: 2001-09-21 |
Encode::MIME::HeaderSection: Perl Programmers Reference Guide (3)Updated: 2001-09-21 |
use Encode qw/encode decode/;
$utf8 = decode('MIME-Header', $header);
$header = encode('MIME-Header', $utf8);
decode() encode()
----------------------------------------------
MIME-Header Both B and Q =?UTF-8?B?....?=
MIME-B B only; Q croaks =?UTF-8?B?....?=
MIME-Q Q only; B croaks =?UTF-8?Q?....?=
When you encode, it just encodes UTF-8 string with X encoding then quoted with =?UTF-8?X?....?= . The parts that RFC 2047 forbids to encode are left as is and long lines are folded within 76 bytes per line.
RFC 2047, <http://www.faqs.org/rfcs/rfc2047.html> and many other locations.