1Encode::MIME::Header(3pmP)erl Programmers Reference GuidEencode::MIME::Header(3pm)
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 dif‐
16 ference 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 hand‐
43 sets which does not grok UTF-8.
44
46 Encode
47
48 RFC 2047, <http://www.faqs.org/rfcs/rfc2047.html> and many other loca‐
49 tions.
50
51
52
53perl v5.8.8 2001-09-21 Encode::MIME::Header(3pm)