SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG
DONATE


YUM REPOSITORY

 
 

MAN page from RedHat EL 3 perl-MIME-Base64-revival-3.09-2.el3.i386.rpm

QuotedPrint

Section: User Contributed Perl Documentation (3)
Updated: 2010-01-25
Index 

NAME

MIME::QuotedPrint - Encoding and decoding of quoted-printable strings 

SYNOPSIS

 use MIME::QuotedPrint;

 $encoded = encode_qp($decoded); $decoded = decode_qp($encoded);
 

DESCRIPTION

This module provides functions to encode and decode strings into and from thequoted-printable encoding specified in RFC 2045 - MIME (MultipurposeInternet Mail Extensions). The quoted-printable encoding is intendedto represent data that largely consists of bytes that correspond toprintable characters in the ASCII character set. Each non-printablecharacter (as defined by English Americans) is represented by atriplet consisting of the character ``='' followed by two hexadecimaldigits.

The following functions are provided:

encode_qp($str)
encode_qp($str, $eol)
encode_qp($str, $eol, $binmode)
This function returns an encoded version of the string ($str) given asargument.

The second argument ($eol) is the line-ending sequence to use. It isoptional and defaults to ``\n''. Every occurrence of ``\n'' is replacedwith this string, and it is also used for additional ``soft linebreaks'' to ensure that no line end up longer than 76 characters. Passit as ``\015\012'' to produce data suitable for external consumption.The string ``\r\n'' produces the same result on many platforms, but notall.

The third argument ($binmode) will select binary mode if passed as aTRUE value. In binary mode ``\n'' will be encoded in the same way asany other non-printable character. This ensures that a decoder willend up with exactly the same string whatever line ending sequence ituses. In general it is preferable to use the base64 encoding forbinary data; see MIME::Base64.

An $eol of "`` (the empty string) is special. In this case, no ''softline breaks`` are introduced and binary mode is effectively enabled sothat any ''\n" in the original data is encoded as well.

decode_qp($str);
This function returns the plain text version of the string givenas argument. The lines of the result are ``\n'' terminated, even ifthe $str argument contains ``\r\n'' terminated lines.

If you prefer not to import these routines into your namespace, you cancall them as:

  use MIME::QuotedPrint ();  $encoded = MIME::QuotedPrint::encode($decoded);  $decoded = MIME::QuotedPrint::decode($encoded);

Perl v5.8 and better allow extended Unicode characters in strings.Such strings cannot be encoded directly, as the quoted-printableencoding is only defined for single-byte characters. The solution isto use the Encode module to select the byte encoding you want. Forexample:

    use MIME::QuotedPrint qw(encode_qp);    use Encode qw(encode);

    $encoded = encode_qp(encode("UTF-8", "\x{FFFF}\n"));    print $encoded;
 

COPYRIGHT

Copyright 1995-1997,2002-2004 Gisle Aas.

This library is free software; you can redistribute it and/ormodify it under the same terms as Perl itself. 

SEE ALSO

MIME::Base64


 

Index

NAME
SYNOPSIS
DESCRIPTION
COPYRIGHT
SEE ALSO

This document was created byman2html,using the manual pages.