diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2016-01-25 08:49:24 +0000 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2016-01-25 13:19:38 +0000 |
commit | 13cf516799483eac70308c6c26cd9a7f00d54238 (patch) | |
tree | 734414d505ef4b9f8315557899158773965dc0e7 /cpan | |
parent | 6fa2dc60899234df7bde728354b58afa2779105e (diff) | |
download | perl-13cf516799483eac70308c6c26cd9a7f00d54238.tar.gz |
Upgrade Encode from version 2.78 to 2.79
This removes two of the blead "customizations", which were actually only
differences in the "$Id:" line, but the third (encoding.pm) has to stay
because the file hasn't otherwise changed so removing the "customization"
would be a change with no $VERSION bump, which causes
t/porting/cmp_version.t to fail. Sigh.
Diffstat (limited to 'cpan')
-rw-r--r-- | cpan/Encode/Encode.pm | 4 | ||||
-rw-r--r-- | cpan/Encode/Encode.xs | 8 | ||||
-rw-r--r-- | cpan/Encode/Makefile.PL | 2 | ||||
-rw-r--r-- | cpan/Encode/Unicode/Unicode.pm | 6 | ||||
-rw-r--r-- | cpan/Encode/Unicode/Unicode.xs | 4 | ||||
-rw-r--r-- | cpan/Encode/lib/Encode/Alias.pm | 4 | ||||
-rw-r--r-- | cpan/Encode/lib/Encode/MIME/Header.pm | 14 | ||||
-rw-r--r-- | cpan/Encode/t/encoding-locale.t | 25 | ||||
-rw-r--r-- | cpan/Encode/t/mime-header.t | 35 |
9 files changed, 66 insertions, 36 deletions
diff --git a/cpan/Encode/Encode.pm b/cpan/Encode/Encode.pm index 6a125d4e41..a09a20c91f 100644 --- a/cpan/Encode/Encode.pm +++ b/cpan/Encode/Encode.pm @@ -1,10 +1,10 @@ # -# $Id: Encode.pm,v 2.78 2015/09/24 02:18:32 dankogai Exp $ +# $Id: Encode.pm,v 2.79 2016/01/22 06:32:20 dankogai Exp $ # package Encode; use strict; use warnings; -our $VERSION = sprintf "%d.%02d", q$Revision: 2.78 $ =~ /(\d+)/g; +our $VERSION = sprintf "%d.%02d", q$Revision: 2.79 $ =~ /(\d+)/g; use constant DEBUG => !!$ENV{PERL_ENCODE_DEBUG}; use XSLoader (); XSLoader::load( __PACKAGE__, $VERSION ); diff --git a/cpan/Encode/Encode.xs b/cpan/Encode/Encode.xs index 81b5deadb0..cd7f7d1050 100644 --- a/cpan/Encode/Encode.xs +++ b/cpan/Encode/Encode.xs @@ -1,5 +1,5 @@ /* - $Id: Encode.xs,v 2.34 2015/09/15 13:53:27 dankogai Exp dankogai $ + $Id: Encode.xs,v 2.35 2016/01/22 06:33:07 dankogai Exp $ */ #define PERL_NO_GET_CONTEXT @@ -20,7 +20,7 @@ encode_method(). 1 is recommended. 2 restores NI-S original */ #define ENCODE_XS_USEFP 1 -#define UNIMPLEMENTED(x,y) y x (SV *sv, char *encoding) { \ +#define UNIMPLEMENTED(x,y) static y x (SV *sv, char *encoding) { \ Perl_croak_nocontext("panic_unimplemented"); \ PERL_UNUSED_VAR(sv); \ PERL_UNUSED_VAR(encoding); \ @@ -42,7 +42,7 @@ UNIMPLEMENTED(_encoded_bytes_to_utf8, I32) UTF8_ALLOW_NON_CONTINUATION | \ UTF8_ALLOW_LONG)) -void +static void Encode_XSEncoding(pTHX_ encode_t * enc) { dSP; @@ -66,7 +66,7 @@ Encode_XSEncoding(pTHX_ encode_t * enc) SvREFCNT_dec(sv); } -void +static void call_failure(SV * routine, U8 * done, U8 * dest, U8 * orig) { /* Exists for breakpointing */ diff --git a/cpan/Encode/Makefile.PL b/cpan/Encode/Makefile.PL index 8f736774e5..e0372ca283 100644 --- a/cpan/Encode/Makefile.PL +++ b/cpan/Encode/Makefile.PL @@ -1,5 +1,5 @@ # -# $Id: Makefile.PL,v 2.16 2015/09/24 02:19:21 dankogai Exp dankogai $ +# $Id: Makefile.PL,v 2.16 2015/09/24 02:19:21 dankogai Exp $ # use 5.007003; use strict; diff --git a/cpan/Encode/Unicode/Unicode.pm b/cpan/Encode/Unicode/Unicode.pm index 316768e639..7dec3e3815 100644 --- a/cpan/Encode/Unicode/Unicode.pm +++ b/cpan/Encode/Unicode/Unicode.pm @@ -4,7 +4,7 @@ use strict; use warnings; no warnings 'redefine'; -our $VERSION = do { my @r = ( q$Revision: 2.14 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $VERSION = do { my @r = ( q$Revision: 2.15 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use XSLoader; XSLoader::load( __PACKAGE__, $VERSION ); @@ -178,7 +178,9 @@ When BE or LE is omitted during decode(), it checks if BOM is at the beginning of the string; if one is found, the endianness is set to what the BOM says. -=item Default Byte Order +=item * + +Default Byte Order When no BOM is found, Encode 2.76 and blow croaked. Since Encode 2.77, it falls back to BE accordingly to RFC2781 and the Unicode diff --git a/cpan/Encode/Unicode/Unicode.xs b/cpan/Encode/Unicode/Unicode.xs index 42f215c713..3bad2adae0 100644 --- a/cpan/Encode/Unicode/Unicode.xs +++ b/cpan/Encode/Unicode/Unicode.xs @@ -1,5 +1,5 @@ /* - $Id: Unicode.xs,v 2.13 2015/09/15 13:53:27 dankogai Exp dankogai $ + $Id: Unicode.xs,v 2.14 2016/01/22 06:33:07 dankogai Exp $ */ #define PERL_NO_GET_CONTEXT @@ -89,7 +89,7 @@ enc_unpack(pTHX_ U8 **sp, U8 *e, STRLEN size, U8 endian) return v; } -void +static void enc_pack(pTHX_ SV *result, STRLEN size, U8 endian, UV value) { U8 *d = (U8 *) SvPV_nolen(result); diff --git a/cpan/Encode/lib/Encode/Alias.pm b/cpan/Encode/lib/Encode/Alias.pm index c0945be7c8..04ad4967c9 100644 --- a/cpan/Encode/lib/Encode/Alias.pm +++ b/cpan/Encode/lib/Encode/Alias.pm @@ -2,7 +2,7 @@ package Encode::Alias; use strict; use warnings; no warnings 'redefine'; -our $VERSION = do { my @r = ( q$Revision: 2.19 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $VERSION = do { my @r = ( q$Revision: 2.20 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use constant DEBUG => !!$ENV{PERL_ENCODE_DEBUG}; use Exporter 'import'; @@ -139,7 +139,7 @@ sub init_aliases { define_alias( qr/^UCS-?2-?LE$/i => '"UCS-2LE"' ); define_alias( qr/^UCS-?2-?(BE)?$/i => '"UCS-2BE"', - qr/^UCS-?4-?(BE|LE)?$/i => 'uc("UTF-32$1")', + qr/^UCS-?4-?(BE|LE|)?$/i => 'uc("UTF-32$1")', qr/^iso-10646-1$/i => '"UCS-2BE"' ); define_alias( diff --git a/cpan/Encode/lib/Encode/MIME/Header.pm b/cpan/Encode/lib/Encode/MIME/Header.pm index 91dd03cbc1..8b2dbb5628 100644 --- a/cpan/Encode/lib/Encode/MIME/Header.pm +++ b/cpan/Encode/lib/Encode/MIME/Header.pm @@ -3,7 +3,7 @@ use strict; use warnings; no warnings 'redefine'; -our $VERSION = do { my @r = ( q$Revision: 2.17 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $VERSION = do { my @r = ( q$Revision: 2.18 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; use Encode qw(find_encoding encode_utf8 decode_utf8); use MIME::Base64; use Carp; @@ -40,9 +40,6 @@ sub decode($$;$) { use utf8; my ( $obj, $str, $chk ) = @_; - # zap spaces between encoded words - $str =~ s/\?=\s+=\?/\?==\?/gos; - # multi-line header to single line $str =~ s/(?:\r\n|[\r\n])[ \t]//gos; @@ -108,12 +105,17 @@ my $re_encoded_word = qr{ my $re_especials = qr{$re_encoded_word|$especials}xo; +# cf: +# https://rt.cpan.org/Ticket/Display.html?id=88717 +# https://www.ietf.org/rfc/rfc0822.txt +my $re_linear_white_space = qr{(?:[ \t]|\r\n?)}; + sub encode($$;$) { my ( $obj, $str, $chk ) = @_; my @line = (); for my $line ( split /\r\n|[\r\n]/o, $str ) { my ( @word, @subline ); - for my $word ( split /($re_especials)/o, $line ) { + for my $word ( split /($re_linear_white_space+)/o, $line ) { if ( $word =~ /[^\x00-\x7f]/o or $word =~ /^$re_encoded_word$/o ) { @@ -136,7 +138,7 @@ sub encode($$;$) { $subline .= $word; } length($subline) and push @subline, $subline; - push @line, join( "\n " => @subline ); + push @line, join( "\n " => grep !/^$/, @subline ); } $_[1] = '' if $chk; return (substr($str, 0, 0) . join( "\n", @line )); diff --git a/cpan/Encode/t/encoding-locale.t b/cpan/Encode/t/encoding-locale.t new file mode 100644 index 0000000000..1153b8ed0a --- /dev/null +++ b/cpan/Encode/t/encoding-locale.t @@ -0,0 +1,25 @@ +# +# This test aims to detect (using CPAN Testers) platforms where the locale +# encoding detection doesn't work. +# + +use strict; +use warnings; + +use Test::More tests => 3; + +use encoding (); +use Encode qw<find_encoding>; + +my $locale_encoding = encoding::_get_locale_encoding; + +SKIP: { + is(ref $locale_encoding, '', '_get_locale_encoding returns a scalar value') + or skip 'no locale encoding found', 1; + + my $enc = find_encoding($locale_encoding); + ok(defined $enc, 'encoding returned is supported') + or diag("Encoding: ", explain($locale_encoding)); + isa_ok($enc, 'Encode::Encoding'); + note($locale_encoding, ' => ', $enc->name); +} diff --git a/cpan/Encode/t/mime-header.t b/cpan/Encode/t/mime-header.t index 83a4448b18..8dfd708e6a 100644 --- a/cpan/Encode/t/mime-header.t +++ b/cpan/Encode/t/mime-header.t @@ -1,5 +1,5 @@ # -# $Id: mime-header.t,v 2.6 2013/08/14 02:29:54 dankogai Exp $ +# $Id: mime-header.t,v 2.7 2016/01/22 06:33:07 dankogai Exp $ # This script is written in utf8 # BEGIN { @@ -73,28 +73,29 @@ Subject: 漢字、カタカナ、ひらがなを含む、非常に長いタイ EOS my $bheader =<<'EOS'; -From:=?UTF-8?B?IOWwj+mjvCDlvL4g?=<dankogai@dan.co.jp> -To: dankogai@dan.co.jp (=?UTF-8?B?5bCP6aO8?==Kogai,=?UTF-8?B?IOW8vg==?== - Dan) -Subject: - =?UTF-8?B?IOa8ouWtl+OAgeOCq+OCv+OCq+ODiuOAgeOBsuOCieOBjOOBquOCkuWQq+OCgA==?= +From: =?UTF-8?B?5bCP6aO8?= =?UTF-8?B?5by+?= <dankogai@dan.co.jp> +To: dankogai@dan.co.jp =?UTF-8?B?KOWwj+mjvD1Lb2dhaSw=?= + =?UTF-8?B?5by+PURhbik=?= +Subject: + =?UTF-8?B?5ryi5a2X44CB44Kr44K/44Kr44OK44CB44Gy44KJ44GM44Gq44KS5ZCr44KA?= =?UTF-8?B?44CB6Z2e5bi444Gr6ZW344GE44K/44Kk44OI44Or6KGM44GM5LiA5L2T5YWo?= =?UTF-8?B?5L2T44Gp44Gu44KI44GG44Gr44GX44GmRW5jb2Rl44GV44KM44KL44Gu44GL?= =?UTF-8?B?77yf?= EOS my $qheader=<<'EOS'; -From:=?UTF-8?Q?=20=E5=B0=8F=E9=A3=BC=20=E5=BC=BE=20?=<dankogai@dan.co.jp> -To: dankogai@dan.co.jp (=?UTF-8?Q?=E5=B0=8F=E9=A3=BC?==Kogai, - =?UTF-8?Q?=20=E5=BC=BE?==Dan) -Subject: - =?UTF-8?Q?=20=E6=BC=A2=E5=AD=97=E3=80=81=E3=82=AB=E3=82=BF=E3=82=AB?= - =?UTF-8?Q?=E3=83=8A=E3=80=81=E3=81=B2=E3=82=89=E3=81=8C=E3=81=AA=E3=82=92?= - =?UTF-8?Q?=E5=90=AB=E3=82=80=E3=80=81=E9=9D=9E=E5=B8=B8=E3=81=AB=E9=95=B7?= - =?UTF-8?Q?=E3=81=84=E3=82=BF=E3=82=A4=E3=83=88=E3=83=AB=E8=A1=8C=E3=81=8C?= - =?UTF-8?Q?=E4=B8=80=E4=BD=93=E5=85=A8=E4=BD=93=E3=81=A9=E3=81=AE=E3=82=88?= - =?UTF-8?Q?=E3=81=86=E3=81=AB=E3=81=97=E3=81=A6Encode=E3=81=95?= - =?UTF-8?Q?=E3=82=8C=E3=82=8B=E3=81=AE=E3=81=8B=EF=BC=9F?= +From: =?UTF-8?Q?=E5=B0=8F=E9=A3=BC?= =?UTF-8?Q?=E5=BC=BE?= + <dankogai@dan.co.jp> +To: dankogai@dan.co.jp =?UTF-8?Q?=28=E5=B0=8F=E9=A3=BC=3DKogai=2C?= + =?UTF-8?Q?=E5=BC=BE=3DDan=29?= +Subject: + =?UTF-8?Q?=E6=BC=A2=E5=AD=97=E3=80=81=E3=82=AB=E3=82=BF=E3=82=AB=E3=83=8A?= + =?UTF-8?Q?=E3=80=81=E3=81=B2=E3=82=89=E3=81=8C=E3=81=AA=E3=82=92=E5=90=AB?= + =?UTF-8?Q?=E3=82=80=E3=80=81=E9=9D=9E=E5=B8=B8=E3=81=AB=E9=95=B7=E3=81=84?= + =?UTF-8?Q?=E3=82=BF=E3=82=A4=E3=83=88=E3=83=AB=E8=A1=8C=E3=81=8C=E4=B8=80?= + =?UTF-8?Q?=E4=BD=93=E5=85=A8=E4=BD=93=E3=81=A9=E3=81=AE=E3=82=88=E3=81=86?= + =?UTF-8?Q?=E3=81=AB=E3=81=97=E3=81=A6Encode=E3=81=95=E3=82=8C?= + =?UTF-8?Q?=E3=82=8B=E3=81=AE=E3=81=8B=EF=BC=9F?= EOS is(Encode::decode('MIME-Header', $bheader), $dheader, "decode B"); |