GSP
Quick Navigator

Search Site

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

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  ENCODE::MIME::HEADER (3)

.ds Aq ’

NAME

Encode::MIME::Header -- MIME ’B’ and ’Q’ header encoding

CONTENTS

SYNOPSIS



    use Encode qw/encode decode/;
    $utf8   = decode(MIME-Header, $header);
    $header = encode(MIME-Header, $utf8);



ABSTRACT

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?....?=



DESCRIPTION

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 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.

BUGS

Before version 2.83 this module had broken both decoder and encoder. Encoder inserted additional spaces, incorrectly encoded input data and produced invalid MIME strings. Decoder lot of times discarded white space characters, incorrectly interpreted data or decoded Base64 string as Quoted-Printable.

As of version 2.83 encoder should be fully compliant of RFC 2047. Due to bugs in previous versions of encoder, decoder is by default in less strict compatible mode. It should be able to decode strings encoded by pre 2.83 version of this module. But this default mode is not correct according to RFC 2047.

In default mode decoder try to decode every substring which looks like MIME encoded data. So it means that MIME data does not need to be separated by white space. To enforce correct strict mode, set package variable $Encode::MIME::Header::STRICT_DECODE to 1, e.g. by localizing:

require Encode::MIME::Header; local $Encode::MIME::Header::STRICT_DECODE = 1;

It would be nice to support encoding to non-UTF8, such as =?ISO-2022-JP? and =?ISO-8859-1?= but that makes the implementation 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 introduced by Makamaka. Thre are still too many MUAs especially cellular phone handsets which does not grok UTF-8.

SEE ALSO

Encode

RFC 2047, <http://www.faqs.org/rfcs/rfc2047.html> and many other locations.

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


perl v5.20.3 ENCODE::MIME::HEADER (3) 2016-03-24

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