1Encode::MIME::Header(3)User Contributed Perl DocumentatioEnncode::MIME::Header(3)
2
3
4
6 Encode::MIME::Header -- MIME 'B' and 'Q' header encoding
7
9 use Encode qw/encode decode/;
10 $utf8 = decode('MIME-Header', $header);
11 $header = encode('MIME-Header', $utf8);
12
14 This module implements RFC 2047 Mime Header Encoding. There are 3
15 variant encoding names; "MIME-Header", "MIME-B" and "MIME-Q". The
16 difference is described below
17
18 decode() encode()
19 ----------------------------------------------
20 MIME-Header Both B and Q =?UTF-8?B?....?=
21 MIME-B B only; Q croaks =?UTF-8?B?....?=
22 MIME-Q Q only; B croaks =?UTF-8?Q?....?=
23
25 When you decode(=?encoding?X?ENCODED WORD?=), ENCODED WORD is extracted
26 and decoded for X encoding (B for Base64, Q for Quoted-Printable). Then
27 the decoded chunk is fed to decode(encoding). So long as encoding is
28 supported by Encode, any source encoding is fine.
29
30 When you encode, it just encodes UTF-8 string with X encoding then
31 quoted with =?UTF-8?X?....?= . The parts that RFC 2047 forbids to
32 encode are left as is and long lines are folded within 76 bytes per
33 line.
34
36 It would be nice to support encoding to non-UTF8, such as
37 =?ISO-2022-JP? and =?ISO-8859-1?= but that makes the implementation
38 too complicated. These days major mail agents all support =?UTF-8? so
39 I think it is just good enough.
40
41 Due to popular demand, 'MIME-Header-ISO_2022_JP' was introduced by
42 Makamaka. Thre are still too many MUAs especially cellular phone
43 handsets which does not grok UTF-8.
44
46 Encode
47
48 RFC 2047, <http://www.faqs.org/rfcs/rfc2047.html> and many other
49 locations.
50
51
52
53perl v5.16.3 2013-04-29 Encode::MIME::Header(3)