#
-# $Id: Base64.pm,v 2.34 2003/10/09 19:15:42 gisle Exp $
+# $Id: Base64.pm,v 2.37 2004/01/08 14:07:26 gisle Exp $
package MIME::Base64;
=head1 DESCRIPTION
-This module provides functions to encode and decode strings into the
-Base64 encoding specified in RFC 2045 - I<MIME (Multipurpose Internet
-Mail Extensions)>. The Base64 encoding is designed to represent
+This module provides functions to encode and decode strings into and from the
+base64 encoding specified in RFC 2045 - I<MIME (Multipurpose Internet
+Mail Extensions)>. The base64 encoding is designed to represent
arbitrary sequences of octets in a form that need not be humanly
readable. A 65-character subset ([A-Za-z0-9+/=]) of US-ASCII is used,
enabling 6 bits to be represented per printable character.
=item encode_base64($str, $eol);
Encode data by calling the encode_base64() function. The first
-argument is the string to encode. The second argument is the line
-ending sequence to use. It is optional and defaults to "\n". The
+argument is the string to encode. The second argument is the
+line-ending sequence to use. It is optional and defaults to "\n". The
returned encoded string is broken into lines of no more than 76
characters each and it will end with $eol unless it is empty. Pass an
empty string as second argument if you do not want the encoded string
-broken into lines.
+to be broken into lines.
=item decode_base64($str)
function takes a single argument which is the string to decode and
returns the decoded data.
-Any character not part of the 65-character base64 subset set is
-silently ignored. Characters occuring after a '=' padding character
+Any character not part of the 65-character base64 subset is
+silently ignored. Characters occurring after a '=' padding character
are never decoded.
If the length of the string to decode, after ignoring
-non-base64 chars, is not a multiple of 4 or padding occurs too early,
+non-base64 chars, is not a multiple of 4 or if padding occurs too early,
then a warning is generated if perl is running under C<-w>.
=back
-If you prefer not to import these routines into your namespace you can
+If you prefer not to import these routines into your namespace, you can
call them as:
use MIME::Base64 ();
=head1 DIAGNOSTICS
-The following warnings might be generated if perl is invoked with the
+The following warnings can be generated if perl is invoked with the
C<-w> switch:
=over 4
perl -MMIME::Base64 -0777 -ne 'print encode_base64($_)' <file
-Decoding does not need slurp mode if all the lines contains a multiple
-of 4 base64 chars:
+Decoding does not need slurp mode if every line contains a multiple
+of four base64 chars:
perl -MMIME::Base64 -ne 'print decode_base64($_)' <file
=head1 COPYRIGHT
-Copyright 1995-1999, 2001-2003 Gisle Aas.
+Copyright 1995-1999, 2001-2004 Gisle Aas.
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
code posted to comp.lang.perl <3pd2lp$6gf@wsinti07.win.tue.nl> by Hans
Mulder <hansm@wsinti07.win.tue.nl>
-The XS implementation use code from metamail. Copyright 1991 Bell
+The XS implementation uses code from metamail. Copyright 1991 Bell
Communications Research, Inc. (Bellcore)
=head1 SEE ALSO
@ISA = qw(Exporter DynaLoader);
@EXPORT = qw(encode_base64 decode_base64);
-$VERSION = '2.21';
+$VERSION = '2.23';
eval { bootstrap MIME::Base64 $VERSION; };
if ($@) {
-/* $Id: Base64.xs,v 1.38 2003/10/09 11:26:12 gisle Exp $
+/* $Id: Base64.xs,v 1.41 2004/01/08 14:07:26 gisle Exp $
-Copyright 1997-2003 Gisle Aas
+Copyright 1997-2004 Gisle Aas
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
MODULE = MIME::Base64 PACKAGE = MIME::QuotedPrint
-#define qp_isplain(c) ((c) == '\t' || ((c) >= ' ' && (c) <= '~') && (c) != '=')
+#define qp_isplain(c) ((c) == '\t' || (((c) >= ' ' && (c) <= '~') && (c) != '='))
SV*
encode_qp(sv,...)
whitespace = 0;
}
if (*str == '=') {
- if ((str + 2) < end && isxdigit(str[1]) && isxdigit(str[2])) {
+ if ((str + 2) < end && isXDIGIT(str[1]) && isXDIGIT(str[2])) {
char buf[3];
str++;
buf[0] = *str++;
+2004-01-08 Gisle Aas <gisle@ActiveState.com>
+
+ Release 2.23
+
+ Documentation fixes by Paul Croome <Paul.Croome@softwareag.com>.
+
+
+
+2004-01-08 Gisle Aas <gisle@ActiveState.com>
+
+ Release 2.22
+
+ Fix 'gcc -Wall' complaints.
+
+
+
2003-10-09 Gisle Aas <gisle@ActiveState.com>
Release 2.21
#
-# $Id: QuotedPrint.pm,v 2.17 2003/10/09 19:04:29 gisle Exp $
+# $Id: QuotedPrint.pm,v 2.19 2004/01/08 14:07:26 gisle Exp $
package MIME::QuotedPrint;
=head1 DESCRIPTION
-This module provides functions to encode and decode strings into the
-Quoted-Printable encoding specified in RFC 2045 - I<MIME (Multipurpose
-Internet Mail Extensions)>. The Quoted-Printable encoding is intended
+This module provides functions to encode and decode strings into and from the
+quoted-printable encoding specified in RFC 2045 - I<MIME (Multipurpose
+Internet Mail Extensions)>. The quoted-printable encoding is intended
to represent data that largely consists of bytes that correspond to
-printable characters in the ASCII character set. Non-printable
-characters (as defined by english americans) are represented by a
+printable characters in the ASCII character set. Each non-printable
+character (as defined by English Americans) is represented by a
triplet consisting of the character "=" followed by two hexadecimal
digits.
=item encode_qp($str, $eol)
-This function will return an encoded version of the string given as
+This function returns an encoded version of the string given as
argument.
-The second argument is the line ending sequence to use. It is
-optional and defaults to "\n". Every occurence of "\n" will be
-replaced with this string and it will also be used for additional
+The second argument is the line-ending sequence to use. It is
+optional and defaults to "\n". Every occurrence of "\n" is
+replaced with this string, and it is also used for additional
"soft line breaks" to ensure that no line is longer than 76
characters. You might want to pass it as "\015\012" to produce data
-suitable external consumption. The string "\r\n" will produce the
+suitable for external consumption. The string "\r\n" produces the
same result on many platforms, but not all.
-An $eol of "" special. If passed no "soft line breaks" are introduced
+An $eol of "" (the empty string) is special. In this case, no "soft line breaks" are introduced
and any literal "\n" in the original data is encoded as well.
=item decode_qp($str);
-This function will return the plain text version of the string given
-as argument. The lines of the result will be "\n" terminated even it
+This function returns the plain text version of the string given
+as argument. The lines of the result are "\n" terminated, even if
the $str argument contains "\r\n" terminated lines.
=back
-If you prefer not to import these routines into your namespace you can
+If you prefer not to import these routines into your namespace, you can
call them as:
use MIME::QuotedPrint ();
$decoded = MIME::QuotedPrint::decode($encoded);
Perl v5.6 and better allow extended Unicode characters in strings.
-Such strings cannot be encoded directly as the quoted-printable
-encoding is only defined for bytes. The solution is to use the Encode
+Such strings cannot be encoded directly, as the quoted-printable
+encoding is only defined for single-byte characters. The solution is to use the Encode
module to select the byte encoding you want. For example:
use MIME::QuotedPrint qw(encode_qp);
=head1 COPYRIGHT
-Copyright 1995-1997,2002-2003 Gisle Aas.
+Copyright 1995-1997,2002-2004 Gisle Aas.
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.