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
Email::MIME::RFC2047::Encoder(3) User Contributed Perl Documentation Email::MIME::RFC2047::Encoder(3)

Email::MIME::RFC2047::Encoder - Encoding of non-ASCII MIME headers

version 0.97

    use Email::MIME::RFC2047::Encoder;

    my $encoder = Email::MIME::RFC2047::Encoder->new(
        encoding => 'utf-8',
        method   => 'Q',
    );

    my $encoded_text   = $encoder->encode_text($string);
    my $encoded_phrase = $encoder->encode_phrase($string);

This module encodes non-ASCII text for MIME email message headers according to RFC 2047.

    my $encoder = Email::MIME::RFC2047::Encoder->new(
        encoding => $encoding,
        method   => $method,
    );

Creates a new encoder object.

encoding specifies the encoding ("character set" in the RFC) to use. This is passed to Encode. See Encode::Supported for supported encodings.

method specifies the encoding method ("encoding" in the RFC). Must be either 'B' or 'Q'.

If both encoding and method are omitted, encoding defaults to 'utf-8' and method to 'Q'. If only encoding is omitted, it defaults to 'utf-8'. If only method is omitted, it defaults to 'B'.

    my $encoded_text = $encoder->encode_text($string);

Encodes a string for use in any Subject or Comments header field, any extension message header field, or any MIME body part field for which the field body is defined as "unstructured" (RFC 2822) or *text (RFC 822). $string is expected to be an unencoded Perl string.

This method tries to use the MIME encoding for as few characters of the input string as possible. So the result may consist of a mix of encoded and unencoded words.

The source string is trimmed and any whitespace is collapsed. The words in the result are separated by single space characters without folding of long lines.

    my $encoded_phrase = $encoder->encode_phrase($string);

Encodes a string that may replace a "phrase" token (as defined by RFC 2822), for example, one that precedes an address in a From, To, or Cc header.

This method works like encode_text but additionally converts remaining text that contains special characters to "quoted-string"s.

Nick Wellnhofer <wellnhofer@aevum.de>

This software is copyright (c) 2017 by Nick Wellnhofer.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2017-07-31 perl v5.32.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.