Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages
Encode::MIME::EncWords(3) User Contributed Perl Documentation Encode::MIME::EncWords(3)

Encode::MIME::EncWords -- MIME 'B' and 'Q' header encoding (alternative)

    use Encode::MIME::EncWords;
    use Encode qw/encode decode/;
    # decode header:
    $utf8   = decode('MIME-EncWords', $header);
    # encode header with default charset, UTF-8:
    $header = encode('MIME-EncWords', $utf8);
    # encode header with another charset:
    Encode::MIME::EncWords->config(Charset => 'GB2312');
    $header = encode('MIME-EncWords', $utf8);

This module implements MIME header encoding described in RFC 2047. There are three variant encoding names and one shorthand special to a charset:
  Encoding name              Result of encode()     Comment
  MIME-EncWords              (auto-detect B or Q)
  MIME-EncWords-B            =?XXXX?B?...?=         Default is UTF-8.
  MIME-EncWords-Q            =?XXXX?Q?...?=                ,,
  MIME-EncWords-ISO_2022_JP  =?ISO-2022-JP?B?...?=
All encodings generate the same result by decode().

This module is intended to be an alternative of "MIME-*" encodings provided by Encode::MIME::Header core module. To find out how to use this module in detail, see Encode.

config(KEY => VALUE, ...);
Class method. Set options by KEY => VALUE pairs. Following options are available.
[encode] Name of character set by which data elements will be converted. Default is "UTF-8". On "MIME-EncWords-ISO_2022_JP" it is fixed to "ISO-2022-JP".
[decode/encode] Try to detect 7-bit charset on unencoded portions. Default is "YES".
[encode] Name of the header field which will be considered on the first line of encoded result in its length. Default is "undef".
[decode/encode] Specify mappings actually used for charset names. Default is "EXTENDED".
[encode] Maximum line length excluding newline. Default is 76.
[encode] Whether to do minimal encoding or not. Default is "YES".
For more details about options see MIME::EncWords.

The encoding modules for MIME header encoding are not the magic porridge pot to cook complex header fields properly.
To decode address header fields (From:, To:, ...), at first parse mailbox-list; then decode each element by encoding module. To encode them, at first encode each element by encoding module; then construct mailbox-list of encoded elements. To construct or parse mailbox-list, some modules such as Mail::Address may be used.
Lines are delimited with LF ("\n"). RFC5322 states that lines in Internet messages are delimited with CRLF ("\r\n").

Please report bugs or buggy behaviors to developer.
CPAN Request Tracker: <>.

Consult $VERSION variable.
This is experimental release. Features might be changed in the near future.
Development versions of this package may be found at <>.

Encode, Encode::MIME::Header, MIME::EncWords.
RFC 2047 MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text.

Hatuka*nezumi - IKEDA Soji <hatuka(at)>

Copyright (C) 2011 Hatuka*nezumi - IKEDA Soji.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
2013-10-29 perl v5.28.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.