diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2010-11-26 00:46:37 +0000 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2010-11-26 00:47:46 +0000 |
commit | 719245bdb37d6b755905afe0a676055044850522 (patch) | |
tree | 18ffd3a1b85ce5a33bf03f54811ea4376956371d /cpan/MIME-Base64 | |
parent | d4456f896c3eddd615abf6048839581863ea6ca3 (diff) | |
download | perl-719245bdb37d6b755905afe0a676055044850522.tar.gz |
Update MIME-Base64 to CPAN version 3.12
[DELTA]
2010-10-25 Gisle Aas <gisle@ActiveState.com>
Release 3.12
Don't change SvUTF8 flag on the strings encoded [RT#60105]
Documentation tweaks
Diffstat (limited to 'cpan/MIME-Base64')
-rw-r--r-- | cpan/MIME-Base64/Base64.pm | 30 | ||||
-rw-r--r-- | cpan/MIME-Base64/Base64.xs | 14 | ||||
-rw-r--r-- | cpan/MIME-Base64/Changes | 10 | ||||
-rw-r--r-- | cpan/MIME-Base64/QuotedPrint.pm | 10 | ||||
-rw-r--r-- | cpan/MIME-Base64/README | 2 | ||||
-rw-r--r-- | cpan/MIME-Base64/t/unicode.t | 25 |
6 files changed, 59 insertions, 32 deletions
diff --git a/cpan/MIME-Base64/Base64.pm b/cpan/MIME-Base64/Base64.pm index 32d387a2f9..c221bf1a7f 100644 --- a/cpan/MIME-Base64/Base64.pm +++ b/cpan/MIME-Base64/Base64.pm @@ -8,7 +8,7 @@ require Exporter; @EXPORT = qw(encode_base64 decode_base64); @EXPORT_OK = qw(encode_base64url decode_base64url encoded_base64_length decoded_base64_length); -$VERSION = '3.11'; +$VERSION = '3.12'; require XSLoader; XSLoader::load('MIME::Base64', $VERSION); @@ -58,24 +58,24 @@ The following primary functions are provided: =over 4 -=item encode_base64($str) +=item encode_base64( $bytes ) -=item encode_base64($str, $eol); +=item encode_base64( $bytes, $eol ); Encode data by calling the encode_base64() function. The first -argument is the string to encode. The second argument is the +argument is the byte 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 to be broken into lines. -The function will croak with "Wide character in subroutine entry" if $str +The function will croak with "Wide character in subroutine entry" if $bytes contains characters with code above 255. The base64 encoding is only defined for single-byte characters. Use the Encode module to select the byte encoding you want. -=item decode_base64($str) +=item decode_base64( $str ) Decode a base64 string by calling the decode_base64() function. This function takes a single argument which is the string to decode and @@ -85,10 +85,6 @@ 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 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 @@ -102,24 +98,24 @@ Additional functions not exported by default: =over 4 -=item encode_base64url($str) +=item encode_base64url( $bytes ) -=item decode_base64url($str) +=item decode_base64url( $str ) Encode and decode according to the base64 scheme for "URL applications" [1]. This is a variant of the base64 encoding which does not use padding, does not break the string into multiple lines and use the characters "-" and "_" instead of "+" and "/" to avoid using reserved URL characters. -=item encoded_base64_length($str) +=item encoded_base64_length( $bytes ) -=item encoded_base64_length($str, $eol) +=item encoded_base64_length( $bytes, $eol ) Returns the length that the encoded string would have without actually -encoding it. This will return the same value as C<< length(encode_base64($str)) >>, +encoding it. This will return the same value as C<< length(encode_base64($bytes)) >>, but should be more efficient. -=item decoded_base64_length($str) +=item decoded_base64_length( $str ) Returns the length that the decoded string would have without actually decoding it. This will return the same value as C<< length(decode_base64($str)) >>, @@ -170,7 +166,7 @@ example: =head1 COPYRIGHT -Copyright 1995-1999, 2001-2004 Gisle Aas. +Copyright 1995-1999, 2001-2004, 2010 Gisle Aas. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/cpan/MIME-Base64/Base64.xs b/cpan/MIME-Base64/Base64.xs index 5bac9ec479..695e24a179 100644 --- a/cpan/MIME-Base64/Base64.xs +++ b/cpan/MIME-Base64/Base64.xs @@ -107,10 +107,11 @@ encode_base64(sv,...) STRLEN rlen; /* length of result string */ unsigned char c1, c2, c3; int chunk; + bool utf8_downgraded; CODE: #if PERL_REVISION == 5 && PERL_VERSION >= 6 - sv_utf8_downgrade(sv, FALSE); + utf8_downgraded = sv_utf8_downgrade(sv, FALSE); #endif str = SvPV(sv, rlen); /* SvPV(sv, len) gives warning for signed len */ len = (SSize_t)rlen; @@ -169,6 +170,10 @@ encode_base64(sv,...) *r++ = *c++; } *r = '\0'; /* every SV in perl should be NUL-terminated */ +#if PERL_REVISION == 5 && PERL_VERSION >= 6 + if (utf8_downgraded) + sv_utf8_upgrade(sv); +#endif OUTPUT: RETVAL @@ -317,10 +322,11 @@ encode_qp(sv,...) char *p; char *p_beg; STRLEN p_len; + bool utf8_downgraded; CODE: #if PERL_REVISION == 5 && PERL_VERSION >= 6 - sv_utf8_downgrade(sv, FALSE); + utf8_downgraded = sv_utf8_downgrade(sv, FALSE); #endif /* set up EOL from the second argument if present, default to "\n" */ if (items > 1 && SvOK(ST(1))) { @@ -412,6 +418,10 @@ encode_qp(sv,...) sv_catpvn(RETVAL, "=", 1); sv_catpvn(RETVAL, eol, eol_len); } +#if PERL_REVISION == 5 && PERL_VERSION >= 6 + if (utf8_downgraded) + sv_utf8_upgrade(sv); +#endif OUTPUT: RETVAL diff --git a/cpan/MIME-Base64/Changes b/cpan/MIME-Base64/Changes index bc360ca0d3..defed05fb5 100644 --- a/cpan/MIME-Base64/Changes +++ b/cpan/MIME-Base64/Changes @@ -1,3 +1,13 @@ +2010-10-25 Gisle Aas <gisle@ActiveState.com> + + Release 3.12 + + Don't change SvUTF8 flag on the strings encoded [RT#60105] + + Documentation tweaks + + + 2010-10-24 Gisle Aas <gisle@ActiveState.com> Release 3.11 diff --git a/cpan/MIME-Base64/QuotedPrint.pm b/cpan/MIME-Base64/QuotedPrint.pm index beb9f84cf1..398d244774 100644 --- a/cpan/MIME-Base64/QuotedPrint.pm +++ b/cpan/MIME-Base64/QuotedPrint.pm @@ -7,7 +7,7 @@ require Exporter; @ISA = qw(Exporter); @EXPORT = qw(encode_qp decode_qp); -$VERSION = "3.11"; +$VERSION = "3.12"; use MIME::Base64; # will load XS version of {en,de}code_qp() @@ -44,11 +44,11 @@ The following functions are provided: =over 4 -=item encode_qp($str) +=item encode_qp( $str) -=item encode_qp($str, $eol) +=item encode_qp( $str, $eol) -=item encode_qp($str, $eol, $binmode) +=item encode_qp( $str, $eol, $binmode ) This function returns an encoded version of the string ($str) given as argument. @@ -72,7 +72,7 @@ An $eol of "" (the empty string) is special. In this case, no "soft line breaks" are introduced and binary mode is effectively enabled so that any "\n" in the original data is encoded as well. -=item decode_qp($str); +=item decode_qp( $str ) This function returns the plain text version of the string given as argument. The lines of the result are "\n" terminated, even if diff --git a/cpan/MIME-Base64/README b/cpan/MIME-Base64/README index fbd3d54cda..93eaa62e12 100644 --- a/cpan/MIME-Base64/README +++ b/cpan/MIME-Base64/README @@ -21,7 +21,7 @@ In order to install and use this package you will need Perl version make test make install -Copyright 1995-1999,2001-2004 Gisle Aas <gisle@ActiveState.com> +Copyright 1995-1999,2001-2004,2010 Gisle Aas <gisle@ActiveState.com> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/cpan/MIME-Base64/t/unicode.t b/cpan/MIME-Base64/t/unicode.t index b09a328b3c..f5dd45d159 100644 --- a/cpan/MIME-Base64/t/unicode.t +++ b/cpan/MIME-Base64/t/unicode.t @@ -9,25 +9,36 @@ BEGIN { } } -print "1..2\n"; +use Test; +plan tests => 8; require MIME::Base64; +require MIME::QuotedPrint; eval { my $tmp = MIME::Base64::encode(v300); print "# enc: $tmp\n"; }; print "# $@" if $@; -print "not " unless $@; -print "ok 1\n"; - -require MIME::QuotedPrint; +ok($@); eval { my $tmp = MIME::QuotedPrint::encode(v300); print "# enc: $tmp\n"; }; print "# $@" if $@; -print "not " unless $@; -print "ok 2\n"; +ok($@); +if (defined &utf8::is_utf8) { + my $str = "aaa" . v300; + ok(utf8::is_utf8($str)); + chop($str); + ok(utf8::is_utf8($str)); + ok(MIME::Base64::encode($str, ""), "YWFh"); + ok(utf8::is_utf8($str)); + ok(MIME::QuotedPrint::encode($str), "aaa=\n"); + ok(utf8::is_utf8($str)); +} +else { + skip("Missing is_utf8") for 1..6; +} |