ext::Encode::lib:PerloPreoxgtr:a:mEmnecrosdeR:e:fleirbe:n:cEncode::MIME::Header(3p)
Encode::MIME::Header -- MIME 'B' and 'Q' header encoding
use Encode qw/encode decode/;
$utf8 = decode('MIME-Header', $header);
$header = encode('MIME-Header', $utf8);
This module implements RFC 2047 Mime Header Encoding. There
are 3 variant encoding names; "MIME-Header", "MIME-B" and
"MIME-Q". The difference is described below
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 decode(=?encoding?X?ENCODED WORD?=), ENCODED WORD
is extracted and decoded for X encoding (B for Base64, Q for
Quoted-Printable). Then the decoded chunk is fed to
decode(encoding). So long as encoding is supported by
Encode, any source encoding is fine.
When you encode, it just encodes UTF-8 string with X encod-
ing 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.
It would be nice to support encoding to non-UTF8, such as
=?ISO-2022-JP? and =?ISO-8859-1?= but that makes the imple-
mentation too complicated. These days major mail agents all
support =?UTF-8? so I think it is just good enough.
Due to popular demand, 'MIME-Header-ISO_2022_JP' was intro-
duced by Makamaka. Thre are still too many MUAs especially
cellular phone handsets which does not grok UTF-8.
Encode
RFC 2047, <http://www.faqs.org/rfcs/rfc2047.html> and many
other locations.
perl v5.8.8 2005-02-05 1
Generated on 2013-04-27 00:20:00 by $MirOS: src/scripts/roff2htm,v 1.77 2013/01/01 20:49:09 tg Exp $
These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002‒2013 The MirOS Project, Germany.
This product includes material
provided by Thorsten Glaser.
This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.