diff options
Diffstat (limited to 'cpan/MIME-Base64')
-rw-r--r-- | cpan/MIME-Base64/Base64.pm | 2 | ||||
-rw-r--r-- | cpan/MIME-Base64/Base64.xs | 20 | ||||
-rw-r--r-- | cpan/MIME-Base64/Changes | 10 | ||||
-rw-r--r-- | cpan/MIME-Base64/QuotedPrint.pm | 2 | ||||
-rw-r--r-- | cpan/MIME-Base64/t/unicode.t | 9 |
5 files changed, 33 insertions, 10 deletions
diff --git a/cpan/MIME-Base64/Base64.pm b/cpan/MIME-Base64/Base64.pm index c221bf1a7f..2ce412d105 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.12'; +$VERSION = '3.13'; require XSLoader; XSLoader::load('MIME::Base64', $VERSION); diff --git a/cpan/MIME-Base64/Base64.xs b/cpan/MIME-Base64/Base64.xs index 695e24a179..b6959bc0f0 100644 --- a/cpan/MIME-Base64/Base64.xs +++ b/cpan/MIME-Base64/Base64.xs @@ -107,11 +107,12 @@ encode_base64(sv,...) STRLEN rlen; /* length of result string */ unsigned char c1, c2, c3; int chunk; - bool utf8_downgraded; + U32 had_utf8; CODE: #if PERL_REVISION == 5 && PERL_VERSION >= 6 - utf8_downgraded = sv_utf8_downgrade(sv, FALSE); + had_utf8 = SvUTF8(sv); + sv_utf8_downgrade(sv, FALSE); #endif str = SvPV(sv, rlen); /* SvPV(sv, len) gives warning for signed len */ len = (SSize_t)rlen; @@ -171,7 +172,7 @@ encode_base64(sv,...) } *r = '\0'; /* every SV in perl should be NUL-terminated */ #if PERL_REVISION == 5 && PERL_VERSION >= 6 - if (utf8_downgraded) + if (had_utf8) sv_utf8_upgrade(sv); #endif @@ -247,12 +248,18 @@ encoded_base64_length(sv,...) PREINIT: SSize_t len; /* length of the string */ STRLEN eollen; /* length of the EOL sequence */ + U32 had_utf8; CODE: #if PERL_REVISION == 5 && PERL_VERSION >= 6 + had_utf8 = SvUTF8(sv); sv_utf8_downgrade(sv, FALSE); #endif len = SvCUR(sv); +#if PERL_REVISION == 5 && PERL_VERSION >= 6 + if (had_utf8) + sv_utf8_upgrade(sv); +#endif if (items > 1 && SvOK(ST(1))) { eollen = SvCUR(ST(1)); @@ -322,11 +329,12 @@ encode_qp(sv,...) char *p; char *p_beg; STRLEN p_len; - bool utf8_downgraded; + U32 had_utf8; CODE: #if PERL_REVISION == 5 && PERL_VERSION >= 6 - utf8_downgraded = sv_utf8_downgrade(sv, FALSE); + had_utf8 = SvUTF8(sv); + sv_utf8_downgrade(sv, FALSE); #endif /* set up EOL from the second argument if present, default to "\n" */ if (items > 1 && SvOK(ST(1))) { @@ -419,7 +427,7 @@ encode_qp(sv,...) sv_catpvn(RETVAL, eol, eol_len); } #if PERL_REVISION == 5 && PERL_VERSION >= 6 - if (utf8_downgraded) + if (had_utf8) sv_utf8_upgrade(sv); #endif diff --git a/cpan/MIME-Base64/Changes b/cpan/MIME-Base64/Changes index defed05fb5..428dcbc13b 100644 --- a/cpan/MIME-Base64/Changes +++ b/cpan/MIME-Base64/Changes @@ -1,3 +1,13 @@ +2010-10-26 Gisle Aas <gisle@ActiveState.com> + + Release 3.13 + + The fix in v3.12 to try to preserve the SvUTF8 flag was buggy + and actually managed to set the flag on strings that did not + have it originally. + + + 2010-10-25 Gisle Aas <gisle@ActiveState.com> Release 3.12 diff --git a/cpan/MIME-Base64/QuotedPrint.pm b/cpan/MIME-Base64/QuotedPrint.pm index 398d244774..d0c71d1043 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.12"; +$VERSION = "3.13"; use MIME::Base64; # will load XS version of {en,de}code_qp() diff --git a/cpan/MIME-Base64/t/unicode.t b/cpan/MIME-Base64/t/unicode.t index f5dd45d159..d6eba554eb 100644 --- a/cpan/MIME-Base64/t/unicode.t +++ b/cpan/MIME-Base64/t/unicode.t @@ -10,7 +10,7 @@ BEGIN { } use Test; -plan tests => 8; +plan tests => 11; require MIME::Base64; require MIME::QuotedPrint; @@ -38,7 +38,12 @@ if (defined &utf8::is_utf8) { ok(utf8::is_utf8($str)); ok(MIME::QuotedPrint::encode($str), "aaa=\n"); ok(utf8::is_utf8($str)); + + utf8::downgrade($str); + ok(!utf8::is_utf8($str)); + ok(MIME::Base64::encode($str, ""), "YWFh"); + ok(!utf8::is_utf8($str)); } else { - skip("Missing is_utf8") for 1..6; + skip("Missing is_utf8") for 1..9; } |